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

Position.within fails when parent dom tree contains css transformations #322

Open
qsiebers opened this issue Oct 14, 2016 · 2 comments
Open
Labels

Comments

@qsiebers
Copy link

Position.within fails to take into account transformations performed by the CSS transform properties. The cause is probably located within Element.cumulativeOffset.

I'm not sure on how to fix this, or if it's even wanted.

@savetheclocktower
Copy link
Collaborator

Yeah, not sure there's much to do about that. Last time I checked (though it's been a few years) there wasn't a reliable way to figure out where an element was on the screen with transforms taken into account. Properties like offsetLeft don't "see" transforms, and even stuff like getBoundingClientRect didn't behave uniformly across browsers when transforms are applied.

But I should check again, so I'll leave this open for now.

@qsiebers
Copy link
Author

It seems you can use window.getComputedStyle() to get the transformation matrix. You can then calculate the new transformed position of the element. I think I'll change my own workaround to use the translate values provided by the matrix.

It might be a nice feature to use all the transformation matrix information in calculating correct location, although this would hardly be optimal unless there is a way to get this information directly from the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants