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

Tooltip positioning on a scaled <div style={{ transform: 'scale(2)' }} /> #2033

Closed
andresgutgon opened this issue Jun 6, 2022 · 5 comments
Closed

Comments

@andresgutgon
Copy link
Contributor

andresgutgon commented Jun 6, 2022

What?

When a chart is inside a div that is scaled tooltip positioning is not correct.

<div style={{ transform: 'scale(2)' }}>
  <MyFancyNivoChart />
</div>

Look at the end how the cursors doesn't correspond with the Mesh that I put in debug mode 👀

zoom-chart.mp4

Describe the solution you'd like

I made a PR with it #2034

Describe alternatives you've considered

The thing is that event position is not calculated ok inside an scaled div. The alternative is to find the scaling factor to calculate position

Additional context

This is the canvas lib I'm using as you can see the nodes can be zoom-in/zoom-out

Thanks

Thanks a lot for Nivo. It's awesome and super well documented. 🙌

@andresgutgon andresgutgon changed the title Tooltip positioning on a scaled canvas Tooltip positioning on a scaled <div style={{ transform: 'scale(2)' }} /> Jun 8, 2022
@andresgutgon
Copy link
Contributor Author

Closing because the PR was merged 🎉 Thank @plouc

@andresgutgon
Copy link
Contributor Author

andresgutgon commented Jul 7, 2022

Hi, @plouc sorry to bother you 🙏 . Maybe it's explained somewhere but I don't find it.
What's the release cycle for changes in Nivo packages? When would be next release?

@plouc
Copy link
Owner

plouc commented Sep 11, 2022

@andresgutgon, no problem, there's no real release cycle, it depends pretty much on the time I can find to work on the project. I've released this fix in 0.80.0, but I missed something, it fixes getRelativeCursor for SVG based implementations but all canvas implementations are broken due to this, as it uses getBBox, which is only available for SVG elements, I'm trying to fix that.

@andresgutgon
Copy link
Contributor Author

Shit : / Sorry for that. We don't use any canvas chart and I missed that

@andresgutgon
Copy link
Contributor Author

Oh! I just saw you fixed it #2125 🙌

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

2 participants