Skip to content

Commit

Permalink
fix(legend): legend close on return in map (#517) (#736)
Browse files Browse the repository at this point in the history
Co-authored-by: Josée Martel <[email protected]>
  • Loading branch information
josee666 and Josée Martel authored Oct 7, 2020
1 parent c579280 commit 847029d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 847029d

Please sign in to comment.