From b0bdef03d3b8bd4846fdf62311713bf067c18684 Mon Sep 17 00:00:00 2001 From: Andrew Hay Kurtz Date: Tue, 28 May 2019 15:08:22 -0700 Subject: [PATCH 1/3] Fix #8273: Layer#setPaintProperty returns true for CrossFadedDataDriven properties --- src/style/style_layer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/style/style_layer.js b/src/style/style_layer.js index 9cfd91bd62f..81113d8145d 100644 --- a/src/style/style_layer.js +++ b/src/style/style_layer.js @@ -155,13 +155,13 @@ class StyleLayer extends Evented { // so a call to _updateLayer is necessary, and we return true from this function so it gets called in // Style#setPaintProperty const prop = this._transitionablePaint._values[name]; - const newCrossFadedValue = prop.property.specification["property-type"] === 'cross-faded-data-driven' && !prop.value.value && value; + const isCrossFadedValue = prop.property.specification["property-type"] === 'cross-faded-data-driven'; const wasDataDriven = this._transitionablePaint._values[name].value.isDataDriven(); this._transitionablePaint.setValue(name, value); const isDataDriven = this._transitionablePaint._values[name].value.isDataDriven(); this._handleSpecialPaintPropertyUpdate(name); - return isDataDriven || wasDataDriven || newCrossFadedValue; + return isDataDriven || wasDataDriven || isCrossFadedValue; } } From c6703964673946cf1e9b356d51117eba3774ff54 Mon Sep 17 00:00:00 2001 From: Andrew Hay Kurtz Date: Tue, 28 May 2019 17:26:10 -0700 Subject: [PATCH 2/3] small refactor on StyleLayer#setPaintProperty --- src/style/style_layer.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/style/style_layer.js b/src/style/style_layer.js index 81113d8145d..fa9ae6d4864 100644 --- a/src/style/style_layer.js +++ b/src/style/style_layer.js @@ -151,17 +151,19 @@ class StyleLayer extends Evented { this._transitionablePaint.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), (value: any) || undefined); return false; } else { - // if a cross-faded value is changed, we need to make sure the new icons get added to each tile's iconAtlas - // so a call to _updateLayer is necessary, and we return true from this function so it gets called in - // Style#setPaintProperty - const prop = this._transitionablePaint._values[name]; - const isCrossFadedValue = prop.property.specification["property-type"] === 'cross-faded-data-driven'; + const transitionable = this._transitionablePaint._values[name]; + const isCrossFadedProperty = transitionable.property.specification["property-type"] === 'cross-faded-data-driven'; + const wasDataDriven = transitionable.value.isDataDriven(); - const wasDataDriven = this._transitionablePaint._values[name].value.isDataDriven(); this._transitionablePaint.setValue(name, value); const isDataDriven = this._transitionablePaint._values[name].value.isDataDriven(); + this._handleSpecialPaintPropertyUpdate(name); - return isDataDriven || wasDataDriven || isCrossFadedValue; + + // if a cross-faded value is changed, we need to make sure the new icons get added to each tile's iconAtlas + // so a call to _updateLayer is necessary, and we return true from this function so it gets called in + // Style#setPaintProperty + return isDataDriven || wasDataDriven || isCrossFadedProperty; } } From 8fd3c5c5e759e4edfbc9e82b58a6497611df301a Mon Sep 17 00:00:00 2001 From: Andrew Hay Kurtz Date: Thu, 30 May 2019 14:11:44 -0700 Subject: [PATCH 3/3] Add render-tests/regressions/mapbox-gl-js#8273 --- src/style/style_layer.js | 4 +- .../mapbox-gl-js#8273/expected.png | Bin 0 -> 4903 bytes .../regressions/mapbox-gl-js#8273/style.json | 43 ++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 test/integration/render-tests/regressions/mapbox-gl-js#8273/expected.png create mode 100644 test/integration/render-tests/regressions/mapbox-gl-js#8273/style.json diff --git a/src/style/style_layer.js b/src/style/style_layer.js index fa9ae6d4864..5f60525e0d4 100644 --- a/src/style/style_layer.js +++ b/src/style/style_layer.js @@ -156,10 +156,10 @@ class StyleLayer extends Evented { const wasDataDriven = transitionable.value.isDataDriven(); this._transitionablePaint.setValue(name, value); - const isDataDriven = this._transitionablePaint._values[name].value.isDataDriven(); - this._handleSpecialPaintPropertyUpdate(name); + const isDataDriven = this._transitionablePaint._values[name].value.isDataDriven(); + // if a cross-faded value is changed, we need to make sure the new icons get added to each tile's iconAtlas // so a call to _updateLayer is necessary, and we return true from this function so it gets called in // Style#setPaintProperty diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#8273/expected.png b/test/integration/render-tests/regressions/mapbox-gl-js#8273/expected.png new file mode 100644 index 0000000000000000000000000000000000000000..5b2447069befe4be9934f083b31cbf08167a7573 GIT binary patch literal 4903 zcmV+?6WHvDP)jbcqB54rYa=d9NDUvp+g`v1}cFy+g`*O~CpUyNUY8X}|J6U#fBKtW5Pr<%7eq4% z{FLink4NKAI>sO(1Yv+x%az5eY*va~n!k+ex_s^1f2P0wsm}`AT<$@tD%*6M0aQeE ze0+SfT`R32(mOD{FSb!B(&~0N@%AY)$uzBQn@0{jOsQ6)H|X;}U;T#u>T|y$F87FH zv6xoX)X2!lR;ONitXV7Ns@2U+6FQM*r82lOKYz*ZhyOL2hB?nuMKC04jw)DQ0A|H_&O?rs#0$?IPuOYlJNx9MvWb+ipyQDTdmG$ zV83n*2@&(_{a`S|wtA~UXl>SY9CE3QHO4&ZxaO_UYQn0uGvibCrN^H&uf2VmAPnjI z1FDTGm3oC+BA$oKU98 z{pKPQ!=q7!ef8DV;q25@Swt*g*(M^&HkZ55Xr~i2qv=E#hJd09#u%FI2A=CNQ5fg= zqsRE>iEq>FwD{hcS4kz3R2o&Rwd@%90iAx=#v-u?yRPfeOVAaxSHQA~b5fPH{B>8Nf-Q&AxUOCS#e&B;*fPNwjL*9qWUFdV4`&>lB z;JO?2S`pWahc+a%mcWKAudh(5RajhGqBrPc!;k|r_fg2@iF#4KcjgC#)?#gl=Xyra zYS(pL-iOOwKvi9~iAbQTMnrn;dTAM};mFW1vlF|yeshWW)di}JDxtN^PVV90>>Nw$ zE4*>;1T&MR%Ufd08!P&>QrrHfqEoQKDXi{k!*3td?kYTKvuRi|h~) z;*lunL<-k&ia`+kHwuM5@5AK|Xw^!;XD!4$XO~rdG2(bBAYxTL$8*=ZYS&|)`AUc# zHY!(-9(?#frBUO?%_Tx>=?(f^T)4u*+7gvUm0JWbA{?68&+gF)-&%c7mAS30tuw%Y zpTXrL)^3!)jPlElE6pGX_FJ`VR!Ug4c#caf5 zon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