Skip to content

Commit

Permalink
Stop propagation for 'scroll' and 'wheel' events
Browse files Browse the repository at this point in the history
Leaflet 1.7 now listens on the generic 'wheel' event to zoom the map, resulting in the map being zoomed while content in a sidebar was scrolled. This fix prevents that.
  • Loading branch information
jeffreykog committed Sep 20, 2020
1 parent 8bb7074 commit aaa4611
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/L.Control.Sidebar.js
Expand Up @@ -68,6 +68,8 @@ L.Control.Sidebar = L.Control.extend({
.on(content, 'touchstart', stop)
.on(content, 'dblclick', fakeStop)
.on(content, 'mousewheel', stop)
.on(content, 'wheel', stop)
.on(content, 'scroll', stop)
.on(content, 'MozMousePixelScroll', stop);

return this;
Expand Down Expand Up @@ -97,6 +99,8 @@ L.Control.Sidebar = L.Control.extend({
.off(content, 'touchstart', stop)
.off(content, 'dblclick', fakeStop)
.off(content, 'mousewheel', stop)
.off(content, 'wheel', stop)
.off(content, 'scroll', stop)
.off(content, 'MozMousePixelScroll', stop);

L.DomEvent
Expand Down

0 comments on commit aaa4611

Please sign in to comment.