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

use transform safe offsetX instead of clientX #215

Merged
merged 2 commits into from
Mar 24, 2017

Conversation

benbenbenbenbenben
Copy link
Contributor

clientX is not desirable for two reasons.

  1. if a css transform is applied, the coordinates may not be correct
  2. clientX needs to take the element position into account to calculate a relative position

offsetX/Y avoids both of these problems

@lavrton
Copy link
Member

lavrton commented Mar 20, 2017

Can you create an example where this update make sense?

@benbenbenbenbenben
Copy link
Contributor Author

benbenbenbenbenben commented Mar 21, 2017

It makes sense in all situations because it is always easier to use the real values directly. That said, off the top of my head try this:

<div style='transform:scale(0.76)'>
    <div id='konvaContainer'></div>
</div>

Your calculated positions will always be wrong.

@lavrton lavrton merged commit b40652e into konvajs:master Mar 24, 2017
@lavrton
Copy link
Member

lavrton commented Mar 24, 2017

I agree. Thanks for good PR.

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

Successfully merging this pull request may close these issues.

2 participants