Skip to content
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

Weird coordinates after rotating, and checking object:modified #1587

Closed
walliski opened this issue Aug 11, 2014 · 2 comments
Closed

Weird coordinates after rotating, and checking object:modified #1587

walliski opened this issue Aug 11, 2014 · 2 comments

Comments

@walliski
Copy link

Hi

http://jsfiddle.net/Walliski/c6mcbtvx/

To reproduce:

  1. Move rectangle to see coordinates in developer console (move by 1-2 px)
  2. Rotate to see new weird coordinates, (1-2º is enough)
  3. Move again 1-2 px, and new coordinates...

in step #2, the coordinates are set from middle of the rectangle, instead of being from the top left corner as otherwise.

Is this intended behavior, or is it a bug? Anyone else that got a similar issue, and know a workaround? Or should I use anything else than object:modified for capturing info on changed objects (size, angle and coordinates)?

@eightypop
Copy link

When you rotate an object around the center you end up setting the origin and coords to be based to the center.

 if (t.action === 'rotate') {
          this._setOriginToCenter(t.target);
        }
        else {
           ...

What ends up feeling wonky is that if you're then moving x/y position it switches back to a top-left origin which is actually the top-left corner before rotation. You get the effect of moving the object to the right and down quite a bit and then rotating around the top-left corner, which wasn't what I was expecting, at least.

To record an object's x, y, scale, rotation in a consistent coordinate space I'm using the getPointByOrigin( ... ) method to always use the center origin.

@asturur
Copy link
Member

asturur commented Jun 8, 2015

Use object property:
centeredRotation: false
to rotate around top left corner and not having coordinates bumping.

@asturur asturur closed this as completed Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants