Skip to content

Commit ea411d2

Browse files
committed
remove existing event listeners
1 parent 6a82dbb commit ea411d2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/components/dragelement/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,23 @@ dragElement.init = function init(options) {
8585
initialTarget,
8686
rightClick;
8787

88+
if(options.dragmode === false) {
89+
if(element.onmousedown) {
90+
element.onmousedown = undefined;
91+
}
92+
if(!supportsPassive) {
93+
if(element.ontouchstart) {
94+
element.ontouchstart = undefined;
95+
}
96+
} else {
97+
if(element._ontouchstart) {
98+
element.removeEventListener('touchstart', element._ontouchstart);
99+
element._ontouchstart = undefined;
100+
}
101+
}
102+
return;
103+
}
104+
88105
if(!gd._mouseDownTime) gd._mouseDownTime = 0;
89106

90107
element.style.pointerEvents = 'all';

0 commit comments

Comments
 (0)