automatically update transformer on some attrs changes

This commit is contained in:
Anton Lavrenov 2018-01-10 09:55:04 +07:00
parent 661fc8de53
commit 7b2eccab5c
3 changed files with 19 additions and 3 deletions

View File

@ -18256,6 +18256,10 @@
(function(Konva) { (function(Konva) {
'use strict'; 'use strict';
var CHANGE_KONVA = 'Change.konva';
var ATTR_CHANGE_LIST = ['keepRatio', 'resizeEnabled', 'rotateHandlerOffset'];
Konva.Transformer = function(config) { Konva.Transformer = function(config) {
this.____init(config); this.____init(config);
}; };
@ -18269,7 +18273,11 @@
this._createElements(); this._createElements();
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);
// update transformer data for certain attr changes
for (var n = 0; n < ATTR_CHANGE_LIST.length; n++) {
this.on(ATTR_CHANGE_LIST[n] + CHANGE_KONVA, this._update);
}
}, },
attachTo: function(node) { attachTo: function(node) {

2
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,9 @@
(function(Konva) { (function(Konva) {
'use strict'; 'use strict';
var CHANGE_KONVA = 'Change.konva';
var ATTR_CHANGE_LIST = ['keepRatio', 'resizeEnabled', 'rotateHandlerOffset'];
Konva.Transformer = function(config) { Konva.Transformer = function(config) {
this.____init(config); this.____init(config);
}; };
@ -13,7 +17,11 @@
this._createElements(); this._createElements();
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);
// update transformer data for certain attr changes
for (var n = 0; n < ATTR_CHANGE_LIST.length; n++) {
this.on(ATTR_CHANGE_LIST[n] + CHANGE_KONVA, this._update);
}
}, },
attachTo: function(node) { attachTo: function(node) {