-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Enable property functions for line-width #4773
Conversation
src/data/bucket/line_bucket.js
Outdated
@@ -50,6 +50,8 @@ const lineInterface = { | |||
{property: 'line-opacity', multiplier: 10, type: 'Uint8'}, | |||
{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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
👍 I like that idea
@lbud awesome 🕵️♀️ !! |
Thanks for making this a priority. Dynamic line-width is an important feature. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-width
has been thatline-dasharray
is scaled byline-width
, so dasharray calculations require the value of a line's width at floor(zoom). This PR accomplishes data-drivenline-width
by 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