unbam / Leaflet.SlideMenu

A simple slide menu for Leaflet.
BSD 2-Clause "Simplified" License
58 stars 19 forks source link

SlideMenu scroller not responding to mouse scroller, instead map zoom event ocurrs #4

Closed gregrowles closed 6 years ago

gregrowles commented 6 years ago

When SlideMenu contains a scrollbar, the mouse (scroller) event applies to Leaflet map instead of SlideMenu; map zooms when menu content should be moving up and down; not consistent with regular user experience

abelduran1 commented 6 years ago

You must put an event listener, when enter on the menu div --> map.scrollWheelZoom.disable(); and when mouseout menu --> map.scrollWheelZoom.enable();

gregrowles commented 6 years ago

Okay, not sure so I'm asking - is it not possible to shift focus to SlideMenu on mouseover instead? Somehow keep the code inside the Plugin instead of writing custom code

unbam commented 6 years ago

I'm sorry for late replay. I'm busy today so I'll push GitHub this week. Solve by adding the following to line 105 of L.Control.SlideMenu.js.

L.DomEvent.on(this._menu, 'mouseover', function(){
    map.scrollWheelZoom.disable();
});
L.DomEvent.on(this._menu, 'mouseout', function(){
    map.scrollWheelZoom.enable();
});
unbam commented 6 years ago

I corresponded to this issue. 7c8f1fd2bf7a380e17d5cbfdcc8794b16dbd5ee9