Repository navigation
Proposal: add icon-anchor property - #5183
Conversation
ChrisLoer
left a comment
There was a problem hiding this comment.
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?
jfirebaugh
left a comment
There was a problem hiding this comment.
👍 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-anchorcode.If everyone is 👍 on this I'll work on a native PR as well.
Launch Checklist