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

Allow for correction of dynamic css transformations #5291

Closed
alexhartstone opened this issue Nov 19, 2020 · 4 comments
Closed

Allow for correction of dynamic css transformations #5291

alexhartstone opened this issue Nov 19, 2020 · 4 comments
Labels
bug something broken

Comments

@alexhartstone
Copy link
Contributor

Recently a bug with interactions on css-transformed plots was fixed. However, this fix is not yet dynamic, and doesn't work in the use-case where transforms are being applied dynamically - for instance, to simulate zooming of a plot.

This codepen demonstrates a statically applied transform, applied before, showing the fix working nicely.

This codepen demonstrates a dynamic css transform, applied after plot creation, imitating a zoom in some kind of app - note the hover label position is incorrect for anything other than a fully zoomed-in plot.

The inverse transform matrix that allows this fix to work is stored at plot creation in the _fullLayout property. This issue is to add some kind of update call to the the api to allow for recalculation of this matrix.

@alexhartstone
Copy link
Contributor Author

@archmoj @alexcjohnson FYI - the follow-up issue

@archmoj archmoj added the feature something new label Nov 19, 2020
@alexcjohnson
Copy link
Collaborator

Thanks @alexhartstone

What about this as a strategy: the thing we want to avoid is walking the tree and recreating the transformation matrix on every hover. But at the beginning of a hover event we're already making getBoundingClientRect calls so another such call should be cheap. So how about we not even calculate the transformation during the initial draw, but when we're ready to ask for the transformation, check whether we have one already and whether the bounding box of the entire gd is the same as it was when that was calculated - and recalculate the transformation if either of those is not the case.

Seem reasonable? This way there's nothing active the user needs to do, it'll just work. If the graph is zooming during the hover event the hover won't catch up to this until the mouse moves, but that may actually be for the best.

@alexhartstone would you be interested in trying this out and kicking off another PR?

@alexhartstone
Copy link
Contributor Author

alexhartstone commented Nov 20, 2020

@alexcjohnson that sounds great, I will get on this ASAP - most likely monday australian time (~48 hrs). Thanks for the prompt response!

@archmoj archmoj added bug something broken and removed feature something new labels Nov 27, 2020
@archmoj
Copy link
Contributor

archmoj commented Nov 27, 2020

Fixed by #5302.

@archmoj archmoj closed this as completed Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants