-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix line distances breaking gradient across tile boundaries (#9220)
* Fix line line distances breaking gradients Ensure scaled line distance is computed at least once when calculating the entire line distance, otherwise we hit a corner case where the distance isn't updated. Specifically when the beginning of the line doesn't have a sharp corner. Fixes #8969 * Add render test for line gradient across tile boundaries * Address review comments
- Loading branch information
1 parent
28603d1
commit 980d1fb
Showing
3 changed files
with
63 additions
and
3 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
Binary file added
BIN
+674 Bytes
test/integration/render-tests/line-gradient/gradient-tile-boundaries/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions
56
test/integration/render-tests/line-gradient/gradient-tile-boundaries/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,56 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 128 | ||
} | ||
}, | ||
"center": [ | ||
-77.02803308586635, | ||
38.891047607560125 | ||
], | ||
"zoom": 18, | ||
"sources": { | ||
"gradient": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[-77.028035, 38.890600 ], | ||
[-77.028035, 38.891088 ] | ||
] | ||
} | ||
}, | ||
"lineMetrics": true | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "line", | ||
"type": "line", | ||
"source": "gradient", | ||
"layout": { | ||
"line-cap": "round", | ||
"line-join": "round" | ||
}, | ||
"paint": { | ||
"line-width": 15, | ||
"line-gradient": [ | ||
"interpolate", | ||
["linear"], | ||
["line-progress"], | ||
0, "rgba(0, 0, 255, 0)", | ||
0.1, "royalblue", | ||
0.3, "cyan", | ||
0.5, "lime", | ||
0.7, "yellow", | ||
1, "red" | ||
] | ||
} | ||
} | ||
] | ||
} |