Skip to content

Commit 3d4befc

Browse files
committed
fixes #2343 - clear select outlines on mapbox zoomstart
1 parent 9cdba10 commit 3d4befc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/plots/mapbox/mapbox.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
204204

205205
gd.emit('plotly_doubleclick', null);
206206
});
207+
208+
// define clear select on map creation, to keep one ref per map,
209+
// so that map.on / map.off in updateFx works as expected
210+
self.clearSelect = function() {
211+
gd._fullLayout._zoomlayer.selectAll('.select-outline').remove();
212+
};
207213
};
208214

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

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

366373
var dragOptions = {
367374
element: self.div,
@@ -383,6 +390,7 @@ proto.updateFx = function(fullLayout) {
383390
dragElement.init(dragOptions);
384391
} else {
385392
map.dragPan.enable();
393+
map.off('zoomstart', self.clearSelect);
386394
self.div.onmousedown = null;
387395
}
388396
};

0 commit comments

Comments
 (0)