Skip to content

Commit

Permalink
fix boxZoom bug (#4528)
Browse files Browse the repository at this point in the history
* fix boxZoom bug

* actually fix the 🐛
  • Loading branch information
mollymerp authored Apr 18, 2017
1 parent 6f42d00 commit af9bcad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ui/handler/box_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ class BoxZoomHandler {
*/
enable() {
if (this.isEnabled()) return;

// the event listeners for the DragPanHandler have to fire _after_ the event listener for BoxZoomHandler in order,
// for the DragPanHandler's check on map.boxZoom.isActive() to tell whether or not to ignore a keydown event
// so this makes sure the firing order is preserved if the BoxZoomHandler is enabled after the DragPanHandler.
if (this._map.dragPan) this._map.dragPan.disable();
this._el.addEventListener('mousedown', this._onMouseDown, false);
if (this._map.dragPan) this._map.dragPan.enable();

this._enabled = true;
}

Expand Down

0 comments on commit af9bcad

Please sign in to comment.