Skip to content

Commit

Permalink
actions: remove some events when disabling action
Browse files Browse the repository at this point in the history
Close #404
  • Loading branch information
taye committed Aug 27, 2016
1 parent e29c1a3 commit cca4e26
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/actions/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ Interactable.prototype.draggable = function (options) {
if (utils.isBool(options)) {
this.options.drag.enabled = options;

if (!options) {
this.ondragstart = this.ondragstart = this.ondragend = null;
}

return this;
}

Expand Down
5 changes: 5 additions & 0 deletions src/actions/drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ Interactable.prototype.dropzone = function (options) {
if (utils.isBool(options)) {
this.options.drop.enabled = options;

if (!options) {
this.ondragenter = this.ondragleave = this.ondrop
= this.ondropactivate = this.ondropdeactivate = null;
}

return this;
}

Expand Down
4 changes: 4 additions & 0 deletions src/actions/gesture.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ Interactable.prototype.gesturable = function (options) {
if (utils.isBool(options)) {
this.options.gesture.enabled = options;

if (!options) {
this.ongesturestart = this.ongesturestart = this.ongestureend = null;
}

return this;
}

Expand Down
4 changes: 4 additions & 0 deletions src/actions/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ Interactable.prototype.resizable = function (options) {
if (utils.isBool(options)) {
this.options.resize.enabled = options;

if (!options) {
this.onresizestart = this.onresizestart = this.onresizeend = null;
}

return this;
}
return this.options.resize;
Expand Down

0 comments on commit cca4e26

Please sign in to comment.