diff --git a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts index 3175b34..4a4cc23 100644 --- a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts @@ -120,11 +120,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements key = 'file'; } } + let evaluatedStyle =null; var styleEntry = this.stylesCache[key]; 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; for (const key in styles) { if (styles.hasOwnProperty(key)) { - let style = styles[key]; - if(style.geometry_ == null) { - style.setGeometry((feature) => this.geometry(feature)); - } - this.stylesCache[key]=style; + this.stylesCache[key]=styles[key]; } } }