resizer fixes

This commit is contained in:
Anton Lavrenov 2017-12-21 11:07:04 +07:00
parent 310004337d
commit a9ab965bb0
3 changed files with 26 additions and 4 deletions

View File

@ -18240,7 +18240,7 @@
attachTo: function(node) { attachTo: function(node) {
this._el = node; this._el = node;
this._update(); this._update();
this._el.on('dragmove', this._update); this._el.on('dragmove.resizer', this._update);
// this._set(); // this._set();
}, },
@ -18284,6 +18284,9 @@
}); });
anchor.on('mouseout', function() { anchor.on('mouseout', function() {
var layer = this.getLayer(); var layer = this.getLayer();
if (!layer) {
return;
}
document.body.style.cursor = 'default'; document.body.style.cursor = 'default';
this.setStrokeWidth(1); this.setStrokeWidth(1);
layer.draw(); layer.draw();
@ -18553,6 +18556,14 @@
x: width / 2, x: width / 2,
y: -50 y: -50
}); });
},
destroy: function() {
Konva.Group.prototype.destroy.call(this);
this._el.off('.resizer');
window.removeEventListener('mousemove', this.handleMouseMove);
window.removeEventListener('touchmove', this.handleMouseMove);
window.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('touchend', this.handleMouseUp);
} }
}; };
Konva.Util.extend(Konva.Resizer, Konva.Group); Konva.Util.extend(Konva.Resizer, Konva.Group);

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
attachTo: function(node) { attachTo: function(node) {
this._el = node; this._el = node;
this._update(); this._update();
this._el.on('dragmove', this._update); this._el.on('dragmove.resizer', this._update);
// this._set(); // this._set();
}, },
@ -63,6 +63,9 @@
}); });
anchor.on('mouseout', function() { anchor.on('mouseout', function() {
var layer = this.getLayer(); var layer = this.getLayer();
if (!layer) {
return;
}
document.body.style.cursor = 'default'; document.body.style.cursor = 'default';
this.setStrokeWidth(1); this.setStrokeWidth(1);
layer.draw(); layer.draw();
@ -332,6 +335,14 @@
x: width / 2, x: width / 2,
y: -50 y: -50
}); });
},
destroy: function() {
Konva.Group.prototype.destroy.call(this);
this._el.off('.resizer');
window.removeEventListener('mousemove', this.handleMouseMove);
window.removeEventListener('touchmove', this.handleMouseMove);
window.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('touchend', this.handleMouseUp);
} }
}; };
Konva.Util.extend(Konva.Resizer, Konva.Group); Konva.Util.extend(Konva.Resizer, Konva.Group);