Skip to content

Commit cca4e26

Browse files
committed
actions: remove some events when disabling action
Close taye#404
1 parent e29c1a3 commit cca4e26

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

src/actions/drag.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ Interactable.prototype.draggable = function (options) {
158158
if (utils.isBool(options)) {
159159
this.options.drag.enabled = options;
160160

161+
if (!options) {
162+
this.ondragstart = this.ondragstart = this.ondragend = null;
163+
}
164+
161165
return this;
162166
}
163167

src/actions/drop.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ Interactable.prototype.dropzone = function (options) {
346346
if (utils.isBool(options)) {
347347
this.options.drop.enabled = options;
348348

349+
if (!options) {
350+
this.ondragenter = this.ondragleave = this.ondrop
351+
= this.ondropactivate = this.ondropdeactivate = null;
352+
}
353+
349354
return this;
350355
}
351356

src/actions/gesture.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ Interactable.prototype.gesturable = function (options) {
113113
if (utils.isBool(options)) {
114114
this.options.gesture.enabled = options;
115115

116+
if (!options) {
117+
this.ongesturestart = this.ongesturestart = this.ongestureend = null;
118+
}
119+
116120
return this;
117121
}
118122

src/actions/resize.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ Interactable.prototype.resizable = function (options) {
361361
if (utils.isBool(options)) {
362362
this.options.resize.enabled = options;
363363

364+
if (!options) {
365+
this.onresizestart = this.onresizestart = this.onresizeend = null;
366+
}
367+
364368
return this;
365369
}
366370
return this.options.resize;

0 commit comments

Comments
 (0)