Skip to content

Add *-sort-key layout property for circle, fill, line - #8467

Merged
ansis merged 17 commits into
masterfrom
circle-sort-key
Jul 18, 2019
Merged

ansis merged 17 commits into
masterfrom
circle-sort-key

Conversation

@ahk

@ahk ahk commented Jul 12, 2019 •

Copy link
Copy Markdown
Contributor

This pull request adds support for three new style-spec layout properties: circle-sort-key, line-sort-key, and fill-sort-key.

These properties mirror the symbol-sort-key in terms of function and allow for features of circle, line, or fill 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 and circle layers. Line and fill 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.

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/studio and/or @mapbox/maps-design if this PR includes style spec changes
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port

@andrewharvey andrewharvey mentioned this pull request Jul 12, 2019
5 of 7 tasks

@asheemmamoowala asheemmamoowala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good,.

Mostly had a question about the sortFeaturesByKey flag added to each bucket. Is it really needed?

Comment thread src/style-spec/reference/v8.json Resolved
Comment thread src/data/bucket/line_bucket.js Resolved
@ahk

ahk commented Jul 16, 2019

Copy link
Copy Markdown
Contributor Author

I think the flow-type errors related to layout.get('circle-sort-key') are true positives for a bug. CircleBucket supports both CircleStyleLayer and HeatmapStyleLayer as layer types (completely didn't notice the heatmap support in the bucket) and HeatmapStyleLayer doesn't have layout properties beyond visibility, and definitely not circle-sort-key. All lookups of layout properties within CircleBucket and drawCircles need to be cased on the layer type being used which seems a bit hacky, but I think is the best path forward. There's still the majority of the bucket and draw logic being shared, and I think appropriately shared.

@ansis ansis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Thanks for these latest changes

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

Successfully merging this pull request may close these issues.

3 participants