I have a group of Kinetic.Rectangle objects with draggable set to true. No matter how much you drag the group around, calling rect.getX() or rect.attrs.x, where rect is one of the rectangle objects in the group, e.g.:
var rect = group.get('.rect')[0];
always returns the same value. Anybody know how the get the actual x and y values of where each rectangle is being drawn?
Thanks!
I guess the reason that you get the same results is because you get the relative position of each rec. I usually use the following codes to get the position of my objects:
Shape.getAbsolutePosition().x
or
shape.getPosition().x
hope this would be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With