Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8273: Layer#setPaintProperty returns true for CrossFadedDataDriv… #8289

Merged
merged 3 commits into from
May 31, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/style/style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 newCrossFadedValue = prop.property.specification["property-type"] === 'cross-faded-data-driven' && !prop.value.value && value;
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 || newCrossFadedValue;

// 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;
}
}

Expand Down