add transformstart event

This commit is contained in:
Anton Lavrenov 2018-03-10 08:39:48 +07:00
parent 0d12e94053
commit 4b70236652
3 changed files with 24 additions and 18 deletions

View File

@ -2,7 +2,7 @@
* Konva JavaScript Framework v1.7.6 * Konva JavaScript Framework v1.7.6
* http://konvajs.github.io/ * http://konvajs.github.io/
* Licensed under the MIT * Licensed under the MIT
* Date: Thu Mar 08 2018 * Date: Sat Mar 10 2018
* *
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@ -18444,10 +18444,10 @@
// bindings // bindings
this.handleMouseMove = this.handleMouseMove.bind(this); this.handleMouseMove = this.handleMouseMove.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this); this.handleMouseUp = this.handleMouseUp.bind(this);
this._update = this._update.bind(this); this.update = this.update.bind(this);
// update transformer data for certain attr changes // update transformer data for certain attr changes
this.on(ATTR_CHANGE_LIST, this._update); this.on(ATTR_CHANGE_LIST, this.update);
if (!warningShowed) { if (!warningShowed) {
Konva.Util.warn( Konva.Util.warn(
@ -18462,10 +18462,10 @@
this.detach(); this.detach();
} }
this.setNode(node); this.setNode(node);
node.on('dragmove.resizer', this._update); node.on('dragmove.resizer', this.update);
node.on(TRANSFORM_CHANGE_STR, this._update); node.on(TRANSFORM_CHANGE_STR, this.update);
this._update(); this.update();
}, },
detach: function() { detach: function() {
@ -18601,6 +18601,9 @@
window.addEventListener('touchend', this.handleMouseUp); window.addEventListener('touchend', this.handleMouseUp);
this._transforming = true; this._transforming = true;
this.fire('transformstart');
this.getNode().fire('transformstart');
}, },
handleMouseMove: function(e) { handleMouseMove: function(e) {
@ -18809,10 +18812,10 @@
this.fire('transform'); this.fire('transform');
this.getNode().fire('transform'); this.getNode().fire('transform');
this._update(); this.update();
this.getLayer().batchDraw(); this.getLayer().batchDraw();
}, },
_update: function() { update: function() {
var attrs = this._getNodeRect(); var attrs = this._getNodeRect();
var x = attrs.x; var x = attrs.x;
var y = attrs.y; var y = attrs.y;

6
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -103,10 +103,10 @@
// bindings // bindings
this.handleMouseMove = this.handleMouseMove.bind(this); this.handleMouseMove = this.handleMouseMove.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this); this.handleMouseUp = this.handleMouseUp.bind(this);
this._update = this._update.bind(this); this.update = this.update.bind(this);
// update transformer data for certain attr changes // update transformer data for certain attr changes
this.on(ATTR_CHANGE_LIST, this._update); this.on(ATTR_CHANGE_LIST, this.update);
if (!warningShowed) { if (!warningShowed) {
Konva.Util.warn( Konva.Util.warn(
@ -121,10 +121,10 @@
this.detach(); this.detach();
} }
this.setNode(node); this.setNode(node);
node.on('dragmove.resizer', this._update); node.on('dragmove.resizer', this.update);
node.on(TRANSFORM_CHANGE_STR, this._update); node.on(TRANSFORM_CHANGE_STR, this.update);
this._update(); this.update();
}, },
detach: function() { detach: function() {
@ -260,6 +260,9 @@
window.addEventListener('touchend', this.handleMouseUp); window.addEventListener('touchend', this.handleMouseUp);
this._transforming = true; this._transforming = true;
this.fire('transformstart');
this.getNode().fire('transformstart');
}, },
handleMouseMove: function(e) { handleMouseMove: function(e) {
@ -468,10 +471,10 @@
this.fire('transform'); this.fire('transform');
this.getNode().fire('transform'); this.getNode().fire('transform');
this._update(); this.update();
this.getLayer().batchDraw(); this.getLayer().batchDraw();
}, },
_update: function() { update: function() {
var attrs = this._getNodeRect(); var attrs = this._getNodeRect();
var x = attrs.x; var x = attrs.x;
var y = attrs.y; var y = attrs.y;