Skip to content

Commit

Permalink
Make non-interactive markers not fire pointer events
Browse files Browse the repository at this point in the history
* Make non-interactive markers not fire pointer events, fixes #3936

* Make non-interactive image overlays and SVGs not fire pointer events

* Make gridlayers non-interactive, fixing #2396 too.
  • Loading branch information
IvanSanchez authored and yohanboniface committed Apr 2, 2016
1 parent 4bcc89b commit 0cfe858
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 14 additions & 0 deletions dist/leaflet.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@
cursor: -moz-grabbing;
}

/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}

.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive {
pointer-events: auto;
}

/* visual tweaks */

Expand Down
2 changes: 0 additions & 2 deletions src/layer/vector/SVG.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ L.SVG = L.Renderer.extend({
} else {
path.setAttribute('fill', 'none');
}

path.setAttribute('pointer-events', options.pointerEvents || (options.interactive ? 'visiblePainted' : 'none'));
},

_updatePoly: function (layer, closed) {
Expand Down

2 comments on commit 0cfe858

@nknoop
Copy link

@nknoop nknoop commented on 0cfe858 Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to this change the svg elements that should be interactive and where interactive before, are also non-interactive:-(

@yohanboniface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create an issue with a minimal reproducible test case, and details about your OS, browser, and such.

Please sign in to comment.