-
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
Add line-sort-key and fill-sort-key #8383
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.
Overall this looks great! The only changes that need to be made are updating the js version number that will support this feature to 1.2.0
"type": "number", | ||
"doc": "Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.", | ||
"sdk-support": { | ||
"js": "1.0.0" |
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.
This should be 1.2.0
"type": "number", | ||
"doc": "Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.", | ||
"sdk-support": { | ||
"js": "1.0.0" |
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.
This should be 1.2.0 as well
Thanks for the heads up |
👍 Though it looks like this won't support sorting based on feature-state:
That's okay, but it would open up more use cases of this feature in the future if it was supported. |
@andrewharvey my understanding is that the limitation you describe is rooted in the fact that feature-state broadly speaking has not been extended to layout properties, as opposed to a specific choice that we made for the implementation in this pr. but let me know if I'm missing something |
👉 #8467 |
Is there a reason why |
@shayke I believe the reason is in #8383 (comment), it's just because no one has implemented feature-state for layout properties, as far as I know. Your workaround is exactly what I would suggest. |
This pull request adds support for two new
style-spec
layout properties:line-sort-key
andfill-sort-key
.These properties mirror the
symbol-sort-key
in terms of function and allow for features of eitherline
orfill
type to specify their own sort order. Sort keys are expected to be float values in ascending order (back to front). Features with larger sort keys will be drawn in front of features with smaller sort keys.Addition of the sort key property was motivated by cross-tile draw order issues for
symbol
andcircle
layers.line
andfill
do not suffer from the same cross-tile sorting issues, but these properties are still useful for designers and are supported for flexibility and consistency.Launch Checklist
@mapbox/studio
and/or@mapbox/maps-design
if this PR includes style spec changes@mapbox/gl-native
if this PR includes shader changes or needs a native portcc @mapbox/studio @mapbox/map-design-team @mapbox/gl-native