From 847029dfd1f57a1aaf9bf382051f3673ac372c51 Mon Sep 17 00:00:00 2001 From: josee666 Date: Wed, 7 Oct 2020 12:49:15 -0400 Subject: [PATCH] fix(legend): legend close on return in map (#517) (#736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Josée Martel --- .../layer-legend-item/layer-legend-item.component.ts | 2 -- .../src/lib/layer/layer-legend/layer-legend.component.ts | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/geo/src/lib/layer/layer-legend-item/layer-legend-item.component.ts b/packages/geo/src/lib/layer/layer-legend-item/layer-legend-item.component.ts index c2bc0ce47e..4c16ffd95d 100644 --- a/packages/geo/src/lib/layer/layer-legend-item/layer-legend-item.component.ts +++ b/packages/geo/src/lib/layer/layer-legend-item/layer-legend-item.component.ts @@ -34,8 +34,6 @@ export class LayerLegendItemComponent implements OnInit, OnDestroy { constructor(private networkService: NetworkService) {} ngOnInit() { - this.layer.legendCollapsed = true; - const resolution$ = this.layer.map.viewController.resolution$; this.resolution$$ = resolution$.subscribe(() => { this.onResolutionChange(); diff --git a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts index d17387e842..d9f2c5dab6 100644 --- a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts +++ b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts @@ -165,11 +165,11 @@ export class LayerLegendComponent implements OnInit, OnDestroy { if (layerOptions && layerOptions.legendOptions) { const translate = this.languageService.translate; const title = translate.instant('igo.geo.layer.legend.default'); - const stylesAvailable = [{ name: '', title } as ItemStyleOptions]; + let stylesAvailable = [{ name: '', title } as ItemStyleOptions]; if (layerOptions.legendOptions.stylesAvailable) { - stylesAvailable.concat(layerOptions.legendOptions.stylesAvailable.filter(sA => ( - sA.name.normalize('NFD').replace(/[\u0300-\u036f]/gi, '') !== 'default' && - sA.name.normalize('NFD').replace(/[\u0300-\u036f]/gi, '') !== 'defaut'))); + stylesAvailable = stylesAvailable.concat(layerOptions.legendOptions.stylesAvailable.filter(sA => ( + sA.name.normalize('NFD').replace(/[\u0300-\u036f]/gi, '') !== 'default' && + sA.name.normalize('NFD').replace(/[\u0300-\u036f]/gi, '') !== 'defaut'))); } stylesAvailable.map(s => s.title = s.title.charAt(0).toUpperCase() + s.title.slice(1).replace(/_/g, ' ')); return stylesAvailable;