-
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
Proposal: add icon-anchor
property
#5183
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 great!
When I was trying to make sure I understood how the changes worked, I modified some of the tests to use text-anchor
and icon-anchor
simultaneously with different values. As far as I can tell, the two work totally independently without any problem. Is there any case where we'd want something like an "auto" value for icon-anchor
that followed the value of text-anchor
? I'm thinking of a situation where you're using icon-text-fit
to use an icon as background for a label.
Just curious, why is the branch called iconOffset
? You were starting to work on #5129?
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.
👍 Kind of surprising we didn't implement this until now.
🤦♀️ just a typo 😬 @ChrisLoer — this was totally unrelated to #5129, have not touched that.
Good question — @nickidlugash? I'd be inclined to say no as it seems a bit prescriptive about combining text and icons — when using an icon as a background for a label you'd want both to use the same anchor, but for e.g. placing a label underneath an icon (in the y direction rather than z) you could use |
Awesome! 🎉
I think I would agree with @lbud here – icon+text position relationships are varied enough across use cases that I think it's better to stay agnostic. I think an |
This PR adds
icon-anchor
, which behaves exactly liketext-anchor
. There is no existing ticket on addingicon-anchor
🙊 but I think it's useful in doing things like aligning SDF pins/markers to point to their source Point rather than always being centered/requiring extra space. Incidentally, this was also discussed recently in #5129 (comment). The implementation is very straightforward as it just reusestext-anchor
code.If everyone is 👍 on this I'll work on a native PR as well.
Launch Checklist