Skip to content

Replace getBoundingClientRect calls in axes.js #1988

Closed
@etpinard

Description

@etpinard

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions