mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-27 10:35:23 +01:00
Made <FeatureLayerPopup/> swatch simplier because colors from features are already evaluated
This commit is contained in:
parent
df98cb9c7b
commit
bac8495b3c
1 changed files with 1 additions and 16 deletions
|
@ -58,23 +58,8 @@ class FeatureLayerPopup extends React.Component {
|
||||||
|
|
||||||
if(propName) {
|
if(propName) {
|
||||||
const propertySpec = latest["paint_"+feature.layer.type][propName];
|
const propertySpec = latest["paint_"+feature.layer.type][propName];
|
||||||
|
|
||||||
let color = feature.layer.paint[propName];
|
let color = feature.layer.paint[propName];
|
||||||
|
return String(color);
|
||||||
if(typeof(color) === "object") {
|
|
||||||
if(color.stops) {
|
|
||||||
color = styleFunction.convertFunction(color, propertySpec);
|
|
||||||
}
|
|
||||||
|
|
||||||
const exprResult = expression.createExpression(String(color), propertySpec);
|
|
||||||
const val = exprResult.value.evaluate({
|
|
||||||
zoom: zoom
|
|
||||||
}, feature);
|
|
||||||
return val.toString();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Default color
|
// Default color
|
||||||
|
|
Loading…
Reference in a new issue