From 8494320d1c616b3e51c729ac131ff01175fca49e Mon Sep 17 00:00:00 2001 From: avpeery Date: Thu, 19 May 2022 16:00:59 -0700 Subject: [PATCH 01/12] set draping for terrain --- src/ui/map.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ui/map.js b/src/ui/map.js index 5e52393ab79..3989a5ab79e 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1200,6 +1200,8 @@ class Map extends Camera { } this.style.applyProjectionUpdate(); this._update(true); + } else if (prevProjection.name === 'globe' && this.getProjection().name === 'globe') { + this.style.setTerrainForDraping(); } return this; From 4b4498d38bfbc48d60bc082cc4cff846773b6c5e Mon Sep 17 00:00:00 2001 From: avpeery Date: Thu, 19 May 2022 17:49:31 -0700 Subject: [PATCH 02/12] use map option for terrain draping check --- src/ui/map.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/map.js b/src/ui/map.js index 3989a5ab79e..b27a77023ce 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1200,8 +1200,10 @@ class Map extends Camera { } this.style.applyProjectionUpdate(); this._update(true); - } else if (prevProjection.name === 'globe' && this.getProjection().name === 'globe') { - this.style.setTerrainForDraping(); + } else if (this.transform.projection.requiresDraping) { + if (!this.getTerrain() || !this.style.stylesheet.terrain) { + this.style.setTerrainForDraping(); + } } return this; From 7fb5363c231664e75a4c9293b50108ffa5582d75 Mon Sep 17 00:00:00 2001 From: avpeery Date: Thu, 19 May 2022 18:18:00 -0700 Subject: [PATCH 03/12] move to one line --- src/ui/map.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ui/map.js b/src/ui/map.js index b27a77023ce..0b29e0b4fdb 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1200,10 +1200,8 @@ class Map extends Camera { } this.style.applyProjectionUpdate(); this._update(true); - } else if (this.transform.projection.requiresDraping) { - if (!this.getTerrain() || !this.style.stylesheet.terrain) { - this.style.setTerrainForDraping(); - } + } else if (this.transform.projection.requiresDraping && (!this.getTerrain() || !this.style.stylesheet.terrain)) { + this.style.setTerrainForDraping(); } return this; From ce06754c75fedd5d68428eda2c0f5b514d24a14f Mon Sep 17 00:00:00 2001 From: avpeery Date: Mon, 23 May 2022 13:51:44 -0700 Subject: [PATCH 04/12] wip: add render test --- .../globe/globe-set-style/default/style.json | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 test/integration/render-tests/globe/globe-set-style/default/style.json diff --git a/test/integration/render-tests/globe/globe-set-style/default/style.json b/test/integration/render-tests/globe/globe-set-style/default/style.json new file mode 100644 index 00000000000..824796f8cfa --- /dev/null +++ b/test/integration/render-tests/globe/globe-set-style/default/style.json @@ -0,0 +1,103 @@ +{ + "version": 8, + "sources": {}, + "layers": [], + "metadata": { + "test": { + "operations": [ + ["setStyle", { + "version": 8, + "zoom": 2, + "projection": {"name": "globe"}, + "sources": { + "composite": { + "url": "mapbox://mapbox.mapbox-streets-v8", + "type": "vector" + } + }, + "sprite": "mapbox://sprites/mapbox/basic-v9", + "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "bg", + "type": "background", + "paint": {"background-color": "#000"} + }, + { + "id": "labels", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "filter": ["==", ["geometry-type"], "Point"], + "layout": { + "text-anchor": "top", + "text-radial-offset": 0.5, + "text-field": ["get", "name"], + "text-font": [ + "Roboto Mono Regular", + "Arial Unicode MS Regular" + ], + "text-size": 10, + "text-pitch-alignment": "viewport" + }, + "paint": { + "text-color": "hsl(171, 84.21%, 80.99%)", + "text-halo-color": "#000", + "text-halo-width": 1 + } + } + ] + }], + [ + "wait" + ], + ["setStyle", { + "version": 8, + "zoom": 2, + "projection": {"name": "globe"}, + "sources": { + "composite": { + "url": "mapbox://mapbox.mapbox-streets-v8", + "type": "vector" + } + }, + "sprite": "mapbox://sprites/mapbox/basic-v9", + "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "bg", + "type": "background", + "paint": {"background-color": "red"} + }, + { + "id": "labels", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "filter": ["==", ["geometry-type"], "Point"], + "layout": { + "text-anchor": "top", + "text-radial-offset": 0.5, + "text-field": ["get", "name"], + "text-font": [ + "Roboto Mono Regular", + "Arial Unicode MS Regular" + ], + "text-size": 10, + "text-pitch-alignment": "viewport" + }, + "paint": { + "text-color": "black", + "text-halo-color": "hsl(171, 84.21%, 80.99%)", + "text-halo-width": 1 + } + } + ] + }], + [ + "wait" + ] + ] + } + } +} \ No newline at end of file From 48d85b2117f42759beae0da58195b195d14c9863 Mon Sep 17 00:00:00 2001 From: avpeery Date: Tue, 24 May 2022 09:53:13 -0700 Subject: [PATCH 05/12] fixed error with render test --- .../globe/globe-set-style/default/style.json | 91 +++++-------------- 1 file changed, 24 insertions(+), 67 deletions(-) diff --git a/test/integration/render-tests/globe/globe-set-style/default/style.json b/test/integration/render-tests/globe/globe-set-style/default/style.json index 824796f8cfa..def6db10e2d 100644 --- a/test/integration/render-tests/globe/globe-set-style/default/style.json +++ b/test/integration/render-tests/globe/globe-set-style/default/style.json @@ -1,103 +1,60 @@ { "version": 8, - "sources": {}, - "layers": [], "metadata": { "test": { + "height": 256, + "width": 256, "operations": [ ["setStyle", { "version": 8, - "zoom": 2, "projection": {"name": "globe"}, "sources": { - "composite": { - "url": "mapbox://mapbox.mapbox-streets-v8", - "type": "vector" + "mapbox": { + "type": "vector", + "maxzoom": 14, + "tiles": [ + "local://tiles/{z}-{x}-{y}.mvt" + ] } }, - "sprite": "mapbox://sprites/mapbox/basic-v9", - "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", "layers": [ { - "id": "bg", + "id": "background", "type": "background", - "paint": {"background-color": "#000"} - }, - { - "id": "labels", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "filter": ["==", ["geometry-type"], "Point"], - "layout": { - "text-anchor": "top", - "text-radial-offset": 0.5, - "text-field": ["get", "name"], - "text-font": [ - "Roboto Mono Regular", - "Arial Unicode MS Regular" - ], - "text-size": 10, - "text-pitch-alignment": "viewport" - }, "paint": { - "text-color": "hsl(171, 84.21%, 80.99%)", - "text-halo-color": "#000", - "text-halo-width": 1 + "background-color": "rgb(255,89,252)" } } ] }], - [ - "wait" - ], + ["wait"], ["setStyle", { "version": 8, - "zoom": 2, "projection": {"name": "globe"}, "sources": { - "composite": { - "url": "mapbox://mapbox.mapbox-streets-v8", - "type": "vector" + "mapbox": { + "type": "vector", + "maxzoom": 14, + "tiles": [ + "local://tiles/{z}-{x}-{y}.mvt" + ] } }, - "sprite": "mapbox://sprites/mapbox/basic-v9", - "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", "layers": [ { - "id": "bg", + "id": "background", "type": "background", - "paint": {"background-color": "red"} - }, - { - "id": "labels", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "filter": ["==", ["geometry-type"], "Point"], - "layout": { - "text-anchor": "top", - "text-radial-offset": 0.5, - "text-field": ["get", "name"], - "text-font": [ - "Roboto Mono Regular", - "Arial Unicode MS Regular" - ], - "text-size": 10, - "text-pitch-alignment": "viewport" - }, "paint": { - "text-color": "black", - "text-halo-color": "hsl(171, 84.21%, 80.99%)", - "text-halo-width": 1 + "background-color": "rgb(17,207,20)" } } ] }], - [ - "wait" - ] + ["wait"] ] } - } + }, + "zoom": 2, + "sources": {}, + "layers": [] } \ No newline at end of file From 4180be5eacd8a4c134388d0d699dc31484d4e947 Mon Sep 17 00:00:00 2001 From: avpeery Date: Tue, 24 May 2022 10:11:13 -0700 Subject: [PATCH 06/12] demonstrate issue with mercator --- .../globe/globe-set-style/default/expected.png | Bin 0 -> 1687 bytes .../globe/globe-set-style/default/style.json | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 test/integration/render-tests/globe/globe-set-style/default/expected.png diff --git a/test/integration/render-tests/globe/globe-set-style/default/expected.png b/test/integration/render-tests/globe/globe-set-style/default/expected.png new file mode 100644 index 0000000000000000000000000000000000000000..310e332c497410aed8ebe56dc00030f6cbc8748e GIT binary patch literal 1687 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;3=C|6o-U3d z6>)E`F!C}e@Gv{73I8|qP&jz(zRZ_hCGYIYEtyy*F(orh+RN?xfLns0-$6kqf#J~8 zZodNzKNy)38JPw2;!Bv=4)64@2XI21btQ`c{n057;?cSa}?F)Li70V6Y#xVl<#eQ`Bg_ h7%f1CU`gA^o>Cj4XLw$)2UycEc)I$ztaD0e0swVI3NHWv literal 0 HcmV?d00001 diff --git a/test/integration/render-tests/globe/globe-set-style/default/style.json b/test/integration/render-tests/globe/globe-set-style/default/style.json index def6db10e2d..fe4500e782b 100644 --- a/test/integration/render-tests/globe/globe-set-style/default/style.json +++ b/test/integration/render-tests/globe/globe-set-style/default/style.json @@ -7,7 +7,7 @@ "operations": [ ["setStyle", { "version": 8, - "projection": {"name": "globe"}, + "projection": {"name": "mercator"}, "sources": { "mapbox": { "type": "vector", @@ -30,7 +30,7 @@ ["wait"], ["setStyle", { "version": 8, - "projection": {"name": "globe"}, + "projection": {"name": "mercator"}, "sources": { "mapbox": { "type": "vector", From 7b1c7e1ff6f18b8711f2bc7044c5f92f3e7ebcd5 Mon Sep 17 00:00:00 2001 From: avpeery Date: Tue, 24 May 2022 10:34:52 -0700 Subject: [PATCH 07/12] fix background id to update in second setStyle call --- .../globe-set-style/default/expected.png | Bin 1687 -> 1688 bytes .../globe/globe-set-style/default/style.json | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/render-tests/globe/globe-set-style/default/expected.png b/test/integration/render-tests/globe/globe-set-style/default/expected.png index 310e332c497410aed8ebe56dc00030f6cbc8748e..c81b2cfef02bea375e6d2e6c51ae1406842535cf 100644 GIT binary patch delta 89 zcmV-f0H*(!4VVp(F)~s~L_t(|UhUKY4FDhv13{2Lf`3a$f&?3XbI|M3xz4`B5g?Eh vm Date: Tue, 24 May 2022 10:47:27 -0700 Subject: [PATCH 08/12] bring zoom out to show sphere --- .../render-tests/globe/globe-set-style/default/style.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/render-tests/globe/globe-set-style/default/style.json b/test/integration/render-tests/globe/globe-set-style/default/style.json index 553a1b25303..9d497e81a64 100644 --- a/test/integration/render-tests/globe/globe-set-style/default/style.json +++ b/test/integration/render-tests/globe/globe-set-style/default/style.json @@ -54,7 +54,7 @@ ] } }, - "zoom": 2, + "zoom": 1, "sources": {}, "layers": [] } \ No newline at end of file From d0c3a3282d45541d2fae8faa090b1e68397c8559 Mon Sep 17 00:00:00 2001 From: Aidan H Date: Tue, 24 May 2022 11:59:57 -0600 Subject: [PATCH 09/12] Updating expected.png --- .../globe-set-style/default/expected.png | Bin 1688 -> 3100 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/test/integration/render-tests/globe/globe-set-style/default/expected.png b/test/integration/render-tests/globe/globe-set-style/default/expected.png index c81b2cfef02bea375e6d2e6c51ae1406842535cf..53c7d3942333006a408f6e6af7bc141ed8fbe007 100644 GIT binary patch literal 3100 zcma)8X;f3!7CyNg;0B~5VG=|L5C)3~iWLNXxgaK>B7*`7qH!(`fPg?LHTMQVu?zx& zw3gvLa6+XKu^$KLbGbfuE1p%H*}9eLJho z>zL^Sr);Onc{S?A$u_hasLeYq`A}~bs^1;CAXWL$eBSdj9%JH`{Kiy;HVx+3%AY*? z)hGvGmQa8*+=~Ityf5{r4FR?QDvi#NG~EvKz@R|u?@LXt@?OhE_56xUYUOk3(@k2f z8Q*@r9H4ycT5~d$!tYwBzjL`*7(z2I(Qii#UmTQgc+tB*1tr^~4ezW|>^O0>> z{gP-|yf+s_3FxL%h=%&TV3ug&#YS(g>2OkSUelT@&?WP@EC8Edug9DsN;#Va9?Klw z#7K@Pg67nJQ2=I%4V1d=(F&Z|X=OlAKgdi33+oTzHwFwOz_H1a?2M%|FGcInl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%Sw8icYCc3h6pZc4IZK=?*W79wk|RQQ@x_E)9e zAR61{dZye93qW+VrfoLG9C3z(d*Z{iG)La8(nxv&E<7@glxj5OoQyxiZnssALfJTJ zG`QvNa_EuXcog`S->>&*TZZ*F2LRWL+nwQB2Agc&uLu%@wvKnuBcpLtPm(Jd9qOj( z!iJ2-%Rp%nSUhKG1Z&t_<%B}#G}QA?Ej&SAJrC(fMV+fOqNX=D79!xTRL@(^_zRY5 z6q&_6ERif9kOl)z`$BA}G^S1-;|N&pZkr+f?8 z)B-CdpHAXi_?-C06(V7$qh!2dq>$};X)JVixFYuwO&RaIU)JBcDOGh%X8D~4o63^i zIq}=?a!a8GTV%@YiO;>CHl`)N*_Yz<$hE!VxUn+E@A_mUdCyDH<-scUIxDqkR&NZz zWhU`U;G}oz6CaU!{#V%4Vh8J~=<$^)YebK)OIzNkjeG*hx3b_S%Y6Z0@brEecFL1$ zt=QcI1Gn;Ej7!9;pr*#+&idh<9%=TJ}`Yohag(%%$CW z@+?$L9&dLhKa3YaagLMerKZqfDH*14K==N3_{g}ZtibTYYJ+)K^l4e=!fRe9nBtT9 zXU!fT0vSR5=UgIjOnBEk`yc6m=eMvnI>`!GE=qG%tiqChH7MYScsJi>Sh@(tM?LiG_3W-sVc@))OZ#Z&-7*&0NSQ^ tAtCq_R9>x?8CxAh&zCt9RbRpkTxlXNY?@VYTapIQ&u{T^pK5P`=-;&Q_d@^x literal 1688 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;3=C{Ro-U3d z6>)E`F!C}e@Gv`0aA>Oc_Gn^}t}nju`qIvG`wj~#Oc0sDrf_rj1(tmcj2}2y4l%JQ z#O!;)!qXtHARuPI@bHtXdIG~AhQ Date: Tue, 24 May 2022 21:41:13 -0700 Subject: [PATCH 10/12] better readability --- src/ui/map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/map.js b/src/ui/map.js index 0b29e0b4fdb..9e431a01739 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1200,8 +1200,8 @@ class Map extends Camera { } this.style.applyProjectionUpdate(); this._update(true); - } else if (this.transform.projection.requiresDraping && (!this.getTerrain() || !this.style.stylesheet.terrain)) { - this.style.setTerrainForDraping(); + } else if (this.transform.projection.requiresDraping) { + if (!this.getTerrain() || !this.style.stylesheet.terrain) this.style.setTerrainForDraping(); } return this; From 9b8149602247f56c840f6c96d892a9c8ae106535 Mon Sep 17 00:00:00 2001 From: avpeery Date: Wed, 25 May 2022 23:17:10 -0700 Subject: [PATCH 11/12] fix conditional --- src/ui/map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/map.js b/src/ui/map.js index 9e431a01739..31d58f5e663 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1200,8 +1200,8 @@ class Map extends Camera { } this.style.applyProjectionUpdate(); this._update(true); - } else if (this.transform.projection.requiresDraping) { - if (!this.getTerrain() || !this.style.stylesheet.terrain) this.style.setTerrainForDraping(); + } else if (this.transform.projection.requiresDraping && !this.getTerrain() && !this.style.stylesheet.terrain) { + this.style.setTerrainForDraping(); } return this; From 1b008fb3903fb2c5a36eb79acabe89761d75842e Mon Sep 17 00:00:00 2001 From: avpeery Date: Fri, 27 May 2022 08:07:50 -0700 Subject: [PATCH 12/12] fix lint --- src/ui/map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/map.js b/src/ui/map.js index 31d58f5e663..0adcc661b51 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1201,7 +1201,7 @@ class Map extends Camera { this.style.applyProjectionUpdate(); this._update(true); } else if (this.transform.projection.requiresDraping && !this.getTerrain() && !this.style.stylesheet.terrain) { - this.style.setTerrainForDraping(); + this.style.setTerrainForDraping(); } return this;