From 79f45631a0ee4f30d83393104970e31467047de1 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Thu, 13 Feb 2020 16:14:18 +0100 Subject: [PATCH] Fix Set style Geometry --- .../item-vector-source.component.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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]; } } }