-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable property functions for line-width (#4773)
line-dasharray is scaled by line-width and therefore requires the value of line-width at floor(current z). Therefore in order to enable property functions for line-width, we add an extra phantom paint attribute (which copies the line-width expression, but evaluates it at floor(z)) so that we can move the scaling calculations to the shader.
- Loading branch information
Lauren Budorick
authored
Jun 19, 2017
1 parent
6a64798
commit 09bec65
Showing
24 changed files
with
528 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-9 Bytes
(93%)
test/integration/render-tests/line-dasharray/default/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14 Bytes
(92%)
test/integration/render-tests/line-dasharray/fractional-zoom/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+657 Bytes
...ender-tests/line-dasharray/function--line-width-composite-function/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 152 additions & 0 deletions
152
.../render-tests/line-dasharray/function--line-width-composite-function/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 64 | ||
} | ||
}, | ||
"zoom": 0.5, | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"property": 1 | ||
}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
-10, | ||
-5 | ||
], | ||
[ | ||
10, | ||
-5 | ||
] | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"property": 2 | ||
}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
-10, | ||
0 | ||
], | ||
[ | ||
10, | ||
0 | ||
] | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"property": 3 | ||
}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
-10, | ||
5 | ||
], | ||
[ | ||
10, | ||
5 | ||
] | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "road", | ||
"type": "line", | ||
"source": "geojson", | ||
"paint": { | ||
"line-width": { | ||
"property": "property", | ||
"type": "categorical", | ||
"stops": [ | ||
[ | ||
{ | ||
"zoom": 0, | ||
"value": 1 | ||
}, | ||
1 | ||
], | ||
[ | ||
{ | ||
"zoom": 0, | ||
"value": 2 | ||
}, | ||
2 | ||
], | ||
[ | ||
{ | ||
"zoom": 0, | ||
"value": 3 | ||
}, | ||
3 | ||
], | ||
[ | ||
{ | ||
"zoom": 1, | ||
"value": 1 | ||
}, | ||
4 | ||
], | ||
[ | ||
{ | ||
"zoom": 1, | ||
"value": 2 | ||
}, | ||
5 | ||
], | ||
[ | ||
{ | ||
"zoom": 1, | ||
"value": 3 | ||
}, | ||
6 | ||
] | ||
] | ||
}, | ||
"line-dasharray": { | ||
"stops": [ | ||
[ | ||
0, | ||
[ | ||
1, | ||
1 | ||
] | ||
], | ||
[ | ||
1, | ||
[ | ||
2, | ||
1 | ||
] | ||
] | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+483 Bytes
...render-tests/line-dasharray/function--line-width-property-function/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
09bec65
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.
@lbud - This is going to be a really useful feature - Is there anyway for me to use it asap before the next version is released? I have a project wrapping up where it would really add value
09bec65
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.
@gagecarto we just released v0.39.0 !
09bec65
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.
That's great! You all rock - 🤘🤘🤘