Skip to content

Commit

Permalink
fixes #2343 - clear select outlines on mapbox zoomstart
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Feb 13, 2018
1 parent 9cdba10 commit 3d4befc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/plots/mapbox/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {

gd.emit('plotly_doubleclick', null);
});

// define clear select on map creation, to keep one ref per map,
// so that map.on / map.off in updateFx works as expected
self.clearSelect = function() {
gd._fullLayout._zoomlayer.selectAll('.select-outline').remove();
};
};

proto.updateMap = function(calcData, fullLayout, resolve, reject) {
Expand Down Expand Up @@ -362,6 +368,7 @@ proto.updateFx = function(fullLayout) {

if(dragMode === 'select' || dragMode === 'lasso') {
map.dragPan.disable();
map.on('zoomstart', self.clearSelect);

var dragOptions = {
element: self.div,
Expand All @@ -383,6 +390,7 @@ proto.updateFx = function(fullLayout) {
dragElement.init(dragOptions);
} else {
map.dragPan.enable();
map.off('zoomstart', self.clearSelect);
self.div.onmousedown = null;
}
};
Expand Down

0 comments on commit 3d4befc

Please sign in to comment.