From 99bfc7f5e905ac40507cd3d78ffa97bc744934b7 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Mon, 27 Jan 2020 20:25:11 +0200 Subject: [PATCH] Fix a bug where lines with duplicate endpoint disappear on z18+ (#9218) * fix a bug with vanishing line with duplicate end points * fix flow :( --- src/data/bucket/line_bucket.js | 4 +- src/style-spec/types.js | 6 +-- .../mapbox-gl-js#5171/expected.png | Bin 0 -> 800 bytes .../regressions/mapbox-gl-js#5171/style.json | 35 ++++++++++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 test/integration/render-tests/regressions/mapbox-gl-js#5171/expected.png create mode 100644 test/integration/render-tests/regressions/mapbox-gl-js#5171/style.json diff --git a/src/data/bucket/line_bucket.js b/src/data/bucket/line_bucket.js index d15b18a4c8d..bb63e4d3a4e 100644 --- a/src/data/bucket/line_bucket.js +++ b/src/data/bucket/line_bucket.js @@ -274,8 +274,8 @@ class LineBucket implements Bucket { for (let i = first; i < len; i++) { - nextVertex = isPolygon && i === len - 1 ? - vertices[first + 1] : // if the line is closed, we treat the last vertex like the first + nextVertex = i === len - 1 ? + (isPolygon ? vertices[first + 1] : (undefined: any)) : // if it's a polygon, treat the last vertex like the first vertices[i + 1]; // just the next vertex // if two consecutive vertices exist, skip the current one diff --git a/src/style-spec/types.js b/src/style-spec/types.js index bd74a4f62ba..ecfab1078b5 100644 --- a/src/style-spec/types.js +++ b/src/style-spec/types.js @@ -88,7 +88,8 @@ export type VectorSourceSpecification = { "scheme"?: "xyz" | "tms", "minzoom"?: number, "maxzoom"?: number, - "attribution"?: string + "attribution"?: string, + "promoteId"?: PromoteIdSpecification } export type RasterSourceSpecification = { @@ -112,8 +113,7 @@ export type RasterDEMSourceSpecification = { "maxzoom"?: number, "tileSize"?: number, "attribution"?: string, - "encoding"?: "terrarium" | "mapbox", - "promoteId"?: PromoteIdSpecification + "encoding"?: "terrarium" | "mapbox" } export type GeoJSONSourceSpecification = {| diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#5171/expected.png b/test/integration/render-tests/regressions/mapbox-gl-js#5171/expected.png new file mode 100644 index 0000000000000000000000000000000000000000..8784429cebc22d5e70e9a32eed65a54a03f2259d GIT binary patch literal 800 zcmV+*1K<3KP)k>@zC~2?Zivf`S4MUW9}K55MOJMYkw0 zD2RwCDC!guR6ucb~5vIz))M`}}5S=JgU2uAj_2E=4JD zH=7_P)L{SYY_V=$;$cb<6XtTexl`aHbc_JR1nDQO&)i#4*pfLLa!!?$AU-FNbF=U4iSMp02z2GDP81}P} zYh=AQ`42H>@^*Og2Kn%&s!puGuk(by<5cXaS?$*WL1p*R* z4U)Ots7MW-CIB;*70J~)XFp*GL_m4ceAd8A+D3VQm=$R~TYiNhiV0w)J$neu1A9aW zc51Csaoa!ZUSh~Z3Hf|$FOj97#|XfT(-D!YW@ox=k(f=egVR&_pOFVnfGE#?Fi7iJ z?_IW-*r1i9bu^NB&@KWfjI@z;JtGoxlllwIwhB_jgCGKUr$XUs+47H!koX^07N+l9 zw~7}$NeE_Vh)8Rl-lvQKaRYhMJZa!1RVc}f-vL+8y00=u#C7!BGe<;}0{0Pwy