From 52b4f90b78bf28a10a820e79508007bda4acd1ac Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Thu, 13 Feb 2020 16:51:23 +0100 Subject: [PATCH] Fix selected style --- .../item-vector-source.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 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 4a4cc23..a5d763d 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 @@ -56,10 +56,18 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements getSelectedStyle(feature:Feature):style.Style { let key = feature.get('itemType')+"_selected"; - if(this.stylesCache[key]) { - return this.stylesCache[key]; - } - return this.stylesCache["selected"]; + let evaluatedStyle =null; + var styleEntry = this.stylesCache[key]; + if(styleEntry) { + if(typeof styleEntry === 'function') { + evaluatedStyle = styleEntry(feature); + } else { + evaluatedStyle = styleEntry; + } + } else { + evaluatedStyle = this.stylesCache["selected"]; + } + return evaluatedStyle } ngOnInit() {