-
Notifications
You must be signed in to change notification settings - Fork 11
While boxzoom is active, allow Shift+Drag to pan #14
Copy link
Copy link
Open
Description
We're using this package (Great work, BTW) to keep boxzoom activated on a map so that the users can drag a box to search for markers in an area. This works great. What we now want to do is allow the user to hold Shift while dragging to activate pan mode in Leaflet. I thought this would be easy by doing this:
document.addEventListener('keydown', function(e) {
// Disable box zoom while shift is pressed
if(e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
self.map.boxZoom.setStateOff();
}
});
document.addEventListener('keyup', function(e) {
// Disable box zoom while shift is pressed
if(e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
self.map.boxZoom.setStateOn();
}
});This does successfully disable boxzoom while shift is pressed, and does activate the cursor pointer, but dragging doesn't actually do anything. It doesn't boxzoom AND it doesn't pan. What am I doing wrong here?
Thanks in advance!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels