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
Show file tree
Hide file tree
Changes from all 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
18 changes: 10 additions & 8 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;

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
return isDataDriven || wasDataDriven || isCrossFadedProperty;
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64,
"operations": [
["setPaintProperty", "line", "line-pattern", "zoo_icon"],
["wait"]
]
}
},
"sprite": "local://sprites/emerald",
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "LineString",
"coordinates": [
[
-20,
-20
],
[
20,
20
]
]
}
}
},
"layers": [
{
"id": "line",
"type": "line",
"source": "geojson",
"paint": {
"line-pattern": "generic_icon",
"line-width": 20
}
}
]
}