Skip to content

Commit

Permalink
fix really overscaled lines
Browse files Browse the repository at this point in the history
We resample lines after sharp corners in some situations. Doing this for
really overscaled tiles mean that sometimes the offset to the new vertex
was closer than the precision supported. This disables that after a
certain point.

fix #9009

asdf
  • Loading branch information
ansis committed Nov 26, 2019
1 parent 2eb6fd6 commit dec5eb3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/data/bucket/line_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ class LineBucket implements Bucket {

if (join === 'bevel') miterLimit = 1.05;

const sharpCornerOffset = SHARP_CORNER_OFFSET * (EXTENT / (512 * this.overscaling));
const sharpCornerOffset = this.overscaling < 16 ?
SHARP_CORNER_OFFSET * EXTENT / (512 * this.overscaling) :
0;

// we could be more precise, but it would only save a negligible amount of space
const segment = this.segments.prepareSegment(len * 10, this.layoutVertexArray, this.indexArray);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"version": 8,
"metadata": {
"test": {
"height": 256
}
},
"center": [
0,
0
],
"zoom": 18,
"sources": {
"line": {
"type": "geojson",
"maxzoom": 10,
"data": {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[-180, 70], [0, 0], [100, 80]]
}
}
}
},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "white"
}
},
{
"id": "road",
"type": "line",
"source": "line",
"paint": {
"line-width": 20,
"line-color": "#000"
}
}
]
}

0 comments on commit dec5eb3

Please sign in to comment.