feat: variable line-offset using line-progress #13614
Open
+577
−85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for using
line-progressexpressions inline-offsetto create variable line offsets that change along a line's length.This enables use cases like subway/transit maps with lines that merge and diverge.
Note: Most of this implementation was generated with assistance from Claude Sonnet 4.5. This is a feature I've wanted for a side project for about 2 years, and I couldn't have completed it without AI assistance.
Fixes #12729, #10374
Implementation
VARIABLE_LINE_OFFSETdefine and extended vertex attribute usageVARIABLE_LINE_WIDTHandVARIABLE_LINE_OFFSETare activeline-progressdocumentation to includeline-offsetpropertyThe performance impact should be negligible for typical use cases.
Example Usage
Demo
See
debug/variable-line-offset-demo.htmlfor a working example showing a line with offset varying from -10px to +10px along its length.@mapbox/map-design-team, @mapbox/static-apis this PR includes style spec API
@mapbox/gl-native this PR includes shader changes