From 1046bc70f4a37762118e708aa0cdd82d771be485 Mon Sep 17 00:00:00 2001 From: Anna Peery <42715836+avpeery@users.noreply.github.com> Date: Tue, 31 May 2022 08:46:04 -0700 Subject: [PATCH] Fix setStyle breaking with globe view (#11913) * set draping for terrain * use map option for terrain draping check * move to one line * wip: add render test * fixed error with render test * demonstrate issue with mercator * fix background id to update in second setStyle call * bring zoom out to show sphere * Updating expected.png * better readability * fix conditional * fix lint Co-authored-by: Aidan H --- src/ui/map.js | 2 + .../globe-set-style/default/expected.png | Bin 0 -> 3100 bytes .../globe/globe-set-style/default/style.json | 60 ++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 test/integration/render-tests/globe/globe-set-style/default/expected.png create mode 100644 test/integration/render-tests/globe/globe-set-style/default/style.json diff --git a/src/ui/map.js b/src/ui/map.js index 09d366f8551..bcc4e268c11 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -1208,6 +1208,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(); } return this; 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..53c7d3942333006a408f6e6af7bc141ed8fbe007 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=%&TV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=qu9G+p>ij|8P=CU^a9 zP`f}dhF$S)RN=t7JsJv~=XKmY>OZ1mOZQ1$!q9zXsN6D!a_ty4;AiY!d{wY8y8MbgHFQ<;hC6RzmS$rF%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 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 new file mode 100644 index 00000000000..9d497e81a64 --- /dev/null +++ b/test/integration/render-tests/globe/globe-set-style/default/style.json @@ -0,0 +1,60 @@ +{ + "version": 8, + "metadata": { + "test": { + "height": 256, + "width": 256, + "operations": [ + ["setStyle", { + "version": 8, + "projection": {"name": "globe"}, + "sources": { + "mapbox": { + "type": "vector", + "maxzoom": 14, + "tiles": [ + "local://tiles/{z}-{x}-{y}.mvt" + ] + } + }, + "layers": [ + { + "id": "background1", + "type": "background", + "paint": { + "background-color": "rgb(255,89,252)" + } + } + ] + }], + ["wait"], + ["setStyle", { + "version": 8, + "projection": {"name": "globe"}, + "sources": { + "mapbox": { + "type": "vector", + "maxzoom": 14, + "tiles": [ + "local://tiles/{z}-{x}-{y}.mvt" + ] + } + }, + "layers": [ + { + "id": "background2", + "type": "background", + "paint": { + "background-color": "rgb(17,207,20)" + } + } + ] + }], + ["wait"] + ] + } + }, + "zoom": 1, + "sources": {}, + "layers": [] +} \ No newline at end of file