Skip to content

Commit 05b50b9

Browse files
committed
Fix mapbox click-to-select bug caused by multiple click listeners [1852]
1 parent ac4b909 commit 05b50b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/plots/mapbox/mapbox.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ proto.updateFx = function(fullLayout) {
420420
subplot: self.id
421421
});
422422

423+
// Unregister the old handler before potentially registering
424+
// a new one. Otherwise multiple click handlers might
425+
// be registered resulting in unwanted behavior.
426+
map.off('click', self.onClickInPanHandler);
423427
if(dragMode === 'select' || dragMode === 'lasso') {
424428
map.dragPan.disable();
425429
map.on('zoomstart', self.clearSelect);
@@ -430,8 +434,6 @@ proto.updateFx = function(fullLayout) {
430434
};
431435

432436
dragElement.init(self.dragOptions);
433-
434-
map.off('click', self.onClickInPanHandler);
435437
} else {
436438
map.dragPan.enable();
437439
map.off('zoomstart', self.clearSelect);

0 commit comments

Comments
 (0)