-
-
Notifications
You must be signed in to change notification settings - Fork 942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent shape positions #487
Comments
You are right. That behavior is not consistent. But it is the most convenient to use. To find bounding box of any shape you can use |
Is it possible to move an object by moving it by its client rectangle some how? And things are made very confusing as the |
By default position of a rectangle is its top-left corner. So it should be expected that on rotation with If you want to see the center of the rectangle as its position, you need to change its origin with For more info see: https://konvajs.github.io/docs/posts/Position_vs_Offset.html const rect = new Konva.Rect({
x: 100,
y: 100,
width: 50,
height: 50,
offsetX: 25,
offsetY: 25,
fill: 'green'
});
layer.add(rect);
layer.add(new Konva.Transformer({
node: rect
}))
rect.on('transform', () => {
console.log(rect.x(), rect.y());
}) |
@lavrton |
Try and see how it works. |
Completely missed the jsbin link. It works perfectly, thanks a lot for the help and sorry for being a top tier wanker. |
The problem:
Shapes eg. reactangle, circle, ellipse are default to an inconsistent position.
Circles and ellipses are centered, but rectangle is not.
Why is it a problem?
Try to find the absolute position of a random shape's top left corner.
You couldn't because of this.
The text was updated successfully, but these errors were encountered: