Skip to content

Commit

Permalink
re-enable boxZoom upon removing control (mapbox#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Jan 19, 2017
1 parent edb8be2 commit 2ae27e8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = function(ctx) {
setup.removeLayers();
ctx.ui.removeButtons();
ctx.events.removeEventListeners();
if (ctx.mapBoxZoomOriginalState) ctx.map.boxZoom.enable();
ctx.map = null;
ctx.container = null;
ctx.store = null;
Expand All @@ -36,6 +37,8 @@ module.exports = function(ctx) {
controlContainer = ctx.ui.addButtons();

if (ctx.options.boxSelect) {
// save if the boxZoom is enabled so it can be restored on control removal
ctx.mapBoxZoomOriginalState = map.boxZoom.isEnabled();
map.boxZoom.disable();
// Need to toggle dragPan on and off or else first
// dragPan disable attempt in simple_select doesn't work
Expand Down

0 comments on commit 2ae27e8

Please sign in to comment.