mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 05:14:58 +08:00
Merge pull request #600 from VladimirTechMan/master
Improvements to Node
This commit is contained in:
14
src/Node.ts
14
src/Node.ts
@@ -1379,7 +1379,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
var absOpacity = this.opacity();
|
||||
var parent = this.getParent();
|
||||
if (parent && !parent._isUnderCache) {
|
||||
absOpacity *= this.getParent().getAbsoluteOpacity();
|
||||
absOpacity *= parent.getAbsoluteOpacity();
|
||||
}
|
||||
return absOpacity;
|
||||
}
|
||||
@@ -1620,16 +1620,16 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
* @name Konva.Node#getAbsoluteTransform
|
||||
* @returns {Konva.Transform}
|
||||
*/
|
||||
getAbsoluteTransform(top?) {
|
||||
getAbsoluteTransform(top?: Node): Transform {
|
||||
// if using an argument, we can't cache the result.
|
||||
if (top) {
|
||||
return this._getAbsoluteTransform(top);
|
||||
} else {
|
||||
// if no argument, we can cache the result
|
||||
return this._getCache(ABSOLUTE_TRANSFORM, this._getAbsoluteTransform);
|
||||
return this._getCache(ABSOLUTE_TRANSFORM, this._getAbsoluteTransform) as Transform;
|
||||
}
|
||||
}
|
||||
_getAbsoluteTransform(top) {
|
||||
_getAbsoluteTransform(top?: Node): Transform {
|
||||
var at = new Transform();
|
||||
|
||||
// start with stage and traverse downwards to self
|
||||
@@ -1692,10 +1692,10 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
* @name Konva.Node#getTransform
|
||||
* @returns {Konva.Transform}
|
||||
*/
|
||||
getTransform() {
|
||||
return this._getCache(TRANSFORM, this._getTransform);
|
||||
getTransform(): Transform {
|
||||
return this._getCache(TRANSFORM, this._getTransform) as Transform;
|
||||
}
|
||||
_getTransform() {
|
||||
_getTransform(): Transform {
|
||||
var m = new Transform(),
|
||||
x = this.x(),
|
||||
y = this.y(),
|
||||
|
||||
Reference in New Issue
Block a user