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

Replace getBoundingClientRect calls in axes.js #1988

Closed
etpinard opened this issue Sep 5, 2017 · 0 comments · Fixed by #4165
Closed

Replace getBoundingClientRect calls in axes.js #1988

etpinard opened this issue Sep 5, 2017 · 0 comments · Fixed by #4165
Assignees

Comments

@etpinard
Copy link
Contributor

etpinard commented Sep 5, 2017

From a private convo with @alexcjohnson about #1980 (possibly a duplicate of #298):

alexj
also not for a patch release, but do you have any sense after doing this fix what it would take to get rid of those getBoundingClientRect calls? They’re some of the worst ones we have left, and if we could figure out how to turn them into Drawing.bBox calls plus some calculations it would help a lot with #1902, #888, etc…

etienne
yeah for sure, Drawing.bbox + ax._offset and ax._length should be enough to come up with a formula for ax._boundingBox

alexj
doesn’t it include tick labels?
oh I see tht’s the Drawing.bbox

etienne
exactly
e.g. yaxis._boundingBox.left = ax._offset - /* widest bbox of all y tick labels */ (edited)
- ax.tickwidth ..

alexj
right - probably with some tweaks depending on showline, ticks, etc… tons of edge cases there but it can certainly be done.
can probably be simplified by caching some of those results when the pieces are created.

etienne
right

alexj
anyway would be awesome if you can 🔪 those while this stuff is fresh in your mind.

@etpinard etpinard self-assigned this Aug 20, 2019
etpinard added a commit that referenced this issue Sep 4, 2019
- replace it with getLabelLevelBBox (an extension of getLabelLevelSpan),
  to compute axis margin push values. Use cache to not have to compute
  the (costly) label bounding boxes unnecessarily
- compute ax._depth during Axes.drawOne, which is the measure in px
  between axis position and outward-most part of bounding box,
  we use this for (1) multicategory label, (2) axis title and (3)
  rangeslider positioning
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 a pull request may close this issue.

1 participant