mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
Improved _getAbsoluteTransform() when transformEnabled != 'all'
Only call getTransform() inside _getAbsoluteTransform() when the transformEnabled property is set to 'all'. That also eliminates the need in extra variable (trans) to reference the returned value.
This commit is contained in:
parent
39e022e786
commit
556a58f9dd
@ -1428,16 +1428,14 @@
|
|||||||
},
|
},
|
||||||
_getAbsoluteTransform: function(top) {
|
_getAbsoluteTransform: function(top) {
|
||||||
var at = new Konva.Transform(),
|
var at = new Konva.Transform(),
|
||||||
transformsEnabled,
|
transformsEnabled;
|
||||||
trans;
|
|
||||||
|
|
||||||
// start with stage and traverse downwards to self
|
// start with stage and traverse downwards to self
|
||||||
this._eachAncestorReverse(function(node) {
|
this._eachAncestorReverse(function(node) {
|
||||||
transformsEnabled = node.transformsEnabled();
|
transformsEnabled = node.transformsEnabled();
|
||||||
trans = node.getTransform();
|
|
||||||
|
|
||||||
if (transformsEnabled === 'all') {
|
if (transformsEnabled === 'all') {
|
||||||
at.multiply(trans);
|
at.multiply(node.getTransform());
|
||||||
} else if (transformsEnabled === 'position') {
|
} else if (transformsEnabled === 'position') {
|
||||||
at.translate(node.x(), node.y());
|
at.translate(node.x(), node.y());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user