-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
anchor Markers at their center #4751
Conversation
Seems good to me. We could switch to a CSS approach later (including adding a |
Thanks @andrewharvey ! Can you also round the offsets to the nearest pixel? We had issues w subpixel transforms causing |
a266c43
to
d403456
Compare
Actually they are already rounded at Line 166 in a266c43
I've pulled out this test to get it passing, for some reason in the testing infrastructure the DOM element.offsetWidth isn't working so the test fails.
I've manually tested and it works well even when the Marker has a padding or border. |
d403456
to
4408a22
Compare
@andrewharvey I believe the failing test is due to the changes from upgrading JSDOM (16c75b8). You'll have to use |
Thanks for the pointer @mollymerp. I've updated the unit test now, though it is far away from a real world browser but it's better than nothing I suppose. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @andrewharvey!
Ooo one thing I missed @andrewharvey – I think we should pass the |
I think I have this working now, but I'd like to test it more and I'll need to look into a unit test. |
Ooh sorry for not being more clear – I meant offset the popup by the same additional amount as the marker |
ada9c7e
to
c740468
Compare
Closes #2900 (breaking change!)
Not sure if this is the best approach (tweaking transform translate values) or a CSS approach is best.
Currently if you change the HTML Element's size, it will loose centering until the map camera changes and triggers
Marker._update
.Launch Checklist
anchor Markers at their center by default per Make markers anchored at their center by default #2900