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

Markers, Popups, and offsets #1238

Closed
nonoumasy opened this issue Nov 26, 2020 · 1 comment
Closed

Markers, Popups, and offsets #1238

nonoumasy opened this issue Nov 26, 2020 · 1 comment

Comments

@nonoumasy
Copy link

nonoumasy commented Nov 26, 2020

Just wondering any good practice on how to center the Markers and Popups as well as using offsets to achieve said goal.
On my app, the popups vary in their distance and alignment from the markers. Note: my markers have variable width and heights so I suspect this is part of the reason that it looks as if the popups are not center-aligned to the markers.

Is there any way to center-align markers and popups on the coordinates?

You can check it out here:
https://timelinesapp.netlify.app/timeline/5fbd21ad78fff5f77ae084fd
api is deployed on heroku so it might be sleeping.

Screen Shot 2020-11-26 at 12 18 34 AM (2)

@nonoumasy
Copy link
Author

I figured it out.
The markers and popups are anchored top left per this issue...mapbox/mapbox-gl-js#2900.

So I tried the suggested solution of using marginLeft based on the image size and then dividing it by two. Although centering the anchor would be ideal.

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

1 participant