Leaflet / Leaflet

🍃 JavaScript library for mobile-friendly interactive maps 🇺🇦
https://leafletjs.com
BSD 2-Clause "Simplified" License
40.17k stars 5.75k forks source link

After displaying the polygon, a canvas is created that overlaps all elements on the map #9300

Closed CodeXiD closed 1 month ago

CodeXiD commented 1 month ago

Checklist

Steps to reproduce

Thank you everyone, thank you in advance for your help. I want to track mouseover of some elements on the map (vector tiles), I'm facing a problem, I have a polygon being created when the map is initialized.

this.$L.activePolygon = this.$L.polygon(
        [[0, 0]],
        ACTIVE_POLYGON('OPTIONS'),
      );

Here is the activePolygon config

{
    OPTIONS: {
      stroke: true,
      color: '#36E700',
      fill: true,
      fillColor: '#00DE2D',
      fillOpacity: 0.75,
      zIndex: 10,
    },
    VIEW_ZOOM: 14,
  },

Then at some point I get a call

this.$L.activePolygon
      .setLatLngs(cadNumFromIDB.polygon)
      .addTo(this.$L.mapInstance);

Following this, a canvas element appears that overlaps the entire map, and makes it impossible to track the mouseover event of the elements below it

Снимок экрана 2024-03-22 в 17 29 51

Moreover, when I execute this.$L.activePolygon.remove(); then the canvas still remains, still covering the entire screen size

Expected behavior

I would like that when a polygon is deleted, the canvas is also deleted

Current behavior

Canvas .leaflet-zoom-animated stays the entire screen size, and covers everything, making it impossible to track events

Minimal example reproducing the issue

No response

Environment

CodeXiD commented 1 month ago

Perhaps someone will have a similar problem. In general, the problem was solved, we added the following styles.

.leaflet-overlay-pane canvas.leaflet-zoom-animated {
  pointer-events: none;
}