-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Marker centering cannot adapt to changing marker sizes #5133
Labels
Comments
I don't think we even need to add any wrappers. Just replacing the calculated 50% offset with |
This was referenced Aug 13, 2017
edit: figured it out
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We currently center the marker DOM element on its pivot, by assessing its height and width and incorporating them into the CSS
transform
translations (I think it's this snippet of code).This is great if the marker stays static, but if its size changes at all after instantiation (from content changes, hover interactions, etc), the element is still translated based on its original size, causing the element to go off-center from its pivot.
The solution I'm currently using (and am proposing for the Marker class) is to separate the translation and centering duties, by introducing a child element to tackle the latter. The proposed boilerplate looks like this:
If we style
.marker-centerer
withtransform:translateX(-50%) translateY(-50%)
, it will automatically translate itself by a percentage of its own size, thereby making it adaptable to all future size changes.The text was updated successfully, but these errors were encountered: