Fix Set style Geometry
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2020-02-13 16:14:18 +01:00
parent 6060a8b86a
commit 79f45631a0

View File

@ -120,11 +120,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
key = 'file'; key = 'file';
} }
} }
let evaluatedStyle =null;
var styleEntry = this.stylesCache[key]; var styleEntry = this.stylesCache[key];
if(typeof styleEntry === 'function') { if(typeof styleEntry === 'function') {
return styleEntry(feature); evaluatedStyle = styleEntry(feature);
} else {
evaluatedStyle = styleEntry;
} }
return styleEntry; if(evaluatedStyle.geometry_ == null) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
}
return evaluatedStyle;
}); });
} }
@ -158,11 +164,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
let styles = changes["styles"].currentValue; let styles = changes["styles"].currentValue;
for (const key in styles) { for (const key in styles) {
if (styles.hasOwnProperty(key)) { if (styles.hasOwnProperty(key)) {
let style = styles[key]; this.stylesCache[key]=styles[key];
if(style.geometry_ == null) {
style.setGeometry((feature) => this.geometry(feature));
}
this.stylesCache[key]=style;
} }
} }
} }