This commit is contained in:
Anton Lavrenov
2018-02-05 12:32:48 +07:00
parent 8da2815590
commit 2ee0cc2528
3 changed files with 34 additions and 22 deletions

View File

@@ -18482,6 +18482,8 @@
window.addEventListener('touchmove', this.handleMouseMove); window.addEventListener('touchmove', this.handleMouseMove);
window.addEventListener('mouseup', this.handleMouseUp); window.addEventListener('mouseup', this.handleMouseUp);
window.addEventListener('touchend', this.handleMouseUp); window.addEventListener('touchend', this.handleMouseUp);
this._transforming = true;
}, },
handleMouseMove: function(e) { handleMouseMove: function(e) {
@@ -18642,12 +18644,19 @@
}, },
handleMouseUp: function() { handleMouseUp: function() {
this._removeEvents();
},
_removeEvents: function() {
if (this._transforming) {
this.fire('transformend'); this.fire('transformend');
this._el.fire('transformend'); this._el.fire('transformend');
window.removeEventListener('mousemove', this.handleMouseMove); window.removeEventListener('mousemove', this.handleMouseMove);
window.removeEventListener('touchmove', this.handleMouseMove); window.removeEventListener('touchmove', this.handleMouseMove);
window.removeEventListener('mouseup', this.handleMouseUp); window.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('touchend', this.handleMouseUp); window.removeEventListener('touchend', this.handleMouseUp);
}
this._transforming = false;
}, },
_getAttrs: function() { _getAttrs: function() {
@@ -18771,10 +18780,7 @@
destroy: function() { destroy: function() {
Konva.Group.prototype.destroy.call(this); Konva.Group.prototype.destroy.call(this);
this._el.off('.resizer'); this._el.off('.resizer');
window.removeEventListener('mousemove', this.handleMouseMove); this._removeEvents();
window.removeEventListener('touchmove', this.handleMouseMove);
window.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('touchend', this.handleMouseUp);
} }
}; };
Konva.Util.extend(Konva.Transformer, Konva.Group); Konva.Util.extend(Konva.Transformer, Konva.Group);

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -151,6 +151,8 @@
window.addEventListener('touchmove', this.handleMouseMove); window.addEventListener('touchmove', this.handleMouseMove);
window.addEventListener('mouseup', this.handleMouseUp); window.addEventListener('mouseup', this.handleMouseUp);
window.addEventListener('touchend', this.handleMouseUp); window.addEventListener('touchend', this.handleMouseUp);
this._transforming = true;
}, },
handleMouseMove: function(e) { handleMouseMove: function(e) {
@@ -311,12 +313,19 @@
}, },
handleMouseUp: function() { handleMouseUp: function() {
this._removeEvents();
},
_removeEvents: function() {
if (this._transforming) {
this.fire('transformend'); this.fire('transformend');
this._el.fire('transformend'); this._el.fire('transformend');
window.removeEventListener('mousemove', this.handleMouseMove); window.removeEventListener('mousemove', this.handleMouseMove);
window.removeEventListener('touchmove', this.handleMouseMove); window.removeEventListener('touchmove', this.handleMouseMove);
window.removeEventListener('mouseup', this.handleMouseUp); window.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('touchend', this.handleMouseUp); window.removeEventListener('touchend', this.handleMouseUp);
}
this._transforming = false;
}, },
_getAttrs: function() { _getAttrs: function() {
@@ -440,10 +449,7 @@
destroy: function() { destroy: function() {
Konva.Group.prototype.destroy.call(this); Konva.Group.prototype.destroy.call(this);
this._el.off('.resizer'); this._el.off('.resizer');
window.removeEventListener('mousemove', this.handleMouseMove); this._removeEvents();
window.removeEventListener('touchmove', this.handleMouseMove);
window.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('touchend', this.handleMouseUp);
} }
}; };
Konva.Util.extend(Konva.Transformer, Konva.Group); Konva.Util.extend(Konva.Transformer, Konva.Group);