-
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
Add anchor option to Marker #6350
Conversation
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.
looks good to me! just one comment/suggestion. 🙇♀️
src/ui/marker.js
Outdated
bindAll(['_update', '_onMapClick'], this); | ||
|
||
this._anchor = options && options.anchor || 'middle'; |
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.
should we add a check here so that if a user provides something like new mapboxgl.Marker({anchor: 'left'})
it is valid instead of having to use new mapboxgl.Marker(null, {anchor: 'left'})
?
if we don't want the former to be valid, we should fire a better error because right now it is just Uncaught TypeError: Cannot read property 'add' of undefined
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.
Gonna send a separate PR for this in a sec.
Hmm actually I think the offset's might be backwards the docs state:
I would expect the results to be flipped 🤔 |
The behavior is chosen for consistency with Though now looking at |
Fixes #5640.
Launch Checklist