Repository navigation
Enable property functions for line-width - #4773
Conversation
| {property: 'line-gap-width', multiplier: 10, type: 'Uint8', name: 'a_gapwidth'}, | ||
| {property: 'line-offset', multiplier: 1, type: 'Int8'}, | ||
| {property: 'line-width', multiplier: 10, type: 'Uint8', name: 'a_width'}, | ||
| {property: 'line-width', multiplier: 10, type: 'Uint8', name: 'a_floorwidth'}, |
There was a problem hiding this comment.
This approach looks great!
I wonder if adding a useIntegerZoom: true to the property definition here and using that to making the if (name === 'a_floorwidth') exceptions less exceptional would be good. Or if that would just hide the exception in a bad way.
|
@lbud awesome 🕵️♀️ !! |
|
Thanks for making this a priority. Dynamic line-width is an important feature. |
anandthakker
left a comment
There was a problem hiding this comment.
I like this approach! I don't even think there's a net increase in hackery here: the new special case logic in ProgramConfiguration is offset by the removal of special case handling in LineStyleLayer 🎉
| "maxzoom": 14, | ||
| "tiles": [ | ||
| "local://tiles/{z}-{x}-{y}.mvt" | ||
| ] |
There was a problem hiding this comment.
I'd be in favor of simplifying these render tests using some bare-bones GeoJSON, as that'll make em easier to understand/assess.
|
@anandthakker thanks for the suggestion — simplified geojson fixtures in 467ed46 |
314aeb9 to
0e447be
Compare
* line-dasharray is scaled by line-width and therefore requires the value of line-width at floor(z). Here, we add an extra phantom paint attribute (the value of line-width at floor(z)) so that we can move those calculations to the shader.
…erty name in ProgramConfiguration
Ref #3045
The challenge in implementing data-driven
line-widthhas been thatline-dasharrayis scaled byline-width, so dasharray calculations require the value of a line's width at floor(zoom). This PR accomplishes data-drivenline-widthby moving that calculation to the shader and adding an additional, sort of phantom paint attribute that calculates the value of line-width at floor(zoom). This required a bit of special casing in program_configuration but given the existing situation seemed to me the best option. This would nullify #4158. @ansis @jfirebaugh @nickidlugash @anandthakker — does this seem reasonable?I verified manually with a matrix of
{ line-width: [constant, zoom, property, zoom-and-property] }x
{ line-dasharray: [none, constant, zoom] }and added render tests here to the same effect (the naming in the render suite is a bit verbose 💁).
Launch Checklist