Better calculations for container.getClientRect()

This commit is contained in:
Anton Lavrenov
2019-10-21 10:12:10 -05:00
parent 0669b24cf9
commit d82c11ea95
7 changed files with 98 additions and 9 deletions

View File

@@ -1034,6 +1034,8 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
} else {
return true;
}
} else if (relativeTo && relativeTo !== parent) {
return visible && parent._isVisible(relativeTo);
} else {
return visible;
}

View File

@@ -735,8 +735,10 @@ export class Transformer extends Group {
});
var padding = this.padding();
var scaleX = (newAttrs.width - padding * 2) / pure.width;
var scaleY = (newAttrs.height - padding * 2) / pure.height;
var scaleX = pure.width ? (newAttrs.width - padding * 2) / pure.width : 1;
var scaleY = pure.height
? (newAttrs.height - padding * 2) / pure.height
: 1;
var rotation = Konva.getAngle(node.rotation());
var dx = pure.x * scaleX - padding - node.offsetX() * scaleX;