How to add hover popup to points drawn by canvas in leaflet layer with high efficiency
115EXP 2024.08.14
as title

1 Answer

Set the mouse movement event for the efficient point layer, and then display popup for the queried point, as follows: var layer = new L.supermap.GraphicLayer(graphics, {render: 'canvas',}).addTo(map); layer.on("mousemove", function (e){ console.log(e) if (e.latlng) { L.popup().setLatLng(L.latLng(e.latlng.lat, e.latlng.lng)) .setContent('<p>' + resources.text_latLng + ': ' + JSON.stringify(e.latlng) + '<p>') .addTo(map); }})
242EXP 2024.08.14
...