-
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
improved dashed lines #938
Conversation
Instead of spinning, dashes stretch before reseting at every round zoom. Dash and space length units are now in terms of the line width, not pixels. Dasharrays can be any length, not just 2. Lines with "line-cap": "round" will have round dashes.
This might get re-added if we change how line patterns are implemented.
@ansis Did we decide to scale dashes by line-gap-width? – I think it makes more sense for dashes to always be scaled by line-width (#860 (comment)). |
It's implemented, but can easily be reverted. I don't have enough experience to have an opinion about this. @jfirebaugh are you fine with reverting a5fb9f9, or do you still think scaling by gap-width is better? |
Love the improvements, particularly the more flexible dash pattern. |
Updated tests: mapbox/mapbox-gl-test-suite#12 remaining:
|
If we always scale by |
My vote is to revert this. Can't wait to try out the new dashes! |
Yeah, it seems to work fine. Outer:
Reverted. |
Introduce a StyleLayer class for the in-memory representation of a style layer. It handles constant resolution, paint property cascading, and paint property calculation. The paint functions now accept a layer as one of the parameters and read all layer properties from it. This simplifies the rendering flow quite a bit. The concept of a "bucket" is now something that only the workers need to know about. The main thread does not create buckets, it merely stores the buffers and elementGroups on the tile when they are received from the worker.
_cascade ⇢ _resolve (called automatically) _cascadeClasses ⇢ _cascade (called when classes change) recalculate ⇢ _recalculate (it's internal-only)
This can happen if the referent layer is skipped due to min/maxzoom.
Conflicts: js/render/draw_line.js js/style/style.js package.json
@ansis I merged master here but rendering tests are currently failing. Can you take a look? |
This will need to be merged to master manually (it's targeting mb-pages, which is no longer correct). |
@jfirebaugh all render tests are passing for me. Which ones are failing for you? up to date test-suite? |
I'm seeing the same error as the Travis build:
|
my spec was not up to date. Test fixed in 34fc5b4 |
Merged! |
A new attempt improving dashed lines. Replaces #649
no sliding
Dashes no longer slid along the lines as you zoom. Instead they stretch and then reset at every zoom.
scaled by width
Dashes size units are now scaled up by the line width. This should make it easier to use dashes that look right at every zoom without creating functions for them. So this is what
"line-dasharray": [1, 1]
looks like at line widths 2, 8, 16:If you still need functions, you can use them. They look like this:
longer patterns
Previously dash arrays could only have on dash length value and one gap length. Dash patterns can now be any length.
"line-dasharray": [5, 1, 1, 1, 1, 1, 1, 1]
:round dashes
The ends of the dashes now obey the line-cap layout property, so you can have rounded dashes:
Style spec changes: mapbox/mapbox-gl-style-spec#234
Native port: mapbox/mapbox-gl-native#761
Updated tests: mapbox/mapbox-gl-test-suite#12
Style migration: cutting-room-floor/mapbox-gl-style-lint#37
Styles: mapbox/mapbox-gl-styles#24
TODO