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

zoom point is not based on top of zoomable region. #42

Open
daverodal opened this issue Aug 30, 2018 · 3 comments
Open

zoom point is not based on top of zoomable region. #42

daverodal opened this issue Aug 30, 2018 · 3 comments

Comments

@daverodal
Copy link

https://jsfiddle.net/markarian/wLbocegs/5/

When I add a div full of text above the zoomable region. zoom happens not centered at mouse
point but what seems like distance from top of page. so zoomable region will zoom as if mouse is at top. when it's really at the non zoomable region. See jsfiddle.

I think the zoom point needs to subtract the top of the current div, when the event comes through.

Thanks in advance for look at this.

@anvaka
Copy link
Owner

anvaka commented Sep 8, 2018

Sorry about this bug. A quick workaround would be to wrap your .zoomable into a div - here is an example: https://jsfiddle.net/wLbocegs/6/

The bug happens due to historical reasons of how we compute "local" offsetX/offsetY for various rendering engines (SVG, DOM).

The mouse event comes with clientX which is translated to offsetX using a bounding box of an owner. While this makes sense for SVG, it doesn't make much sense for body's children.

I'm not sure yet how to fix it correctly, but very likely we need to refactor this code and make it robust in face of various rendering engines.

@grishnyakov
Copy link

@grishnyakov
Copy link

time to fix it! Бро, когда починишь?

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

3 participants