mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
automatically update transformer on some attrs changes
This commit is contained in:
parent
661fc8de53
commit
7b2eccab5c
10
konva.js
10
konva.js
@ -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
2
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user