diff --git a/packages/integration/src/lib/map/map-details-tool/map-details-tool.component.ts b/packages/integration/src/lib/map/map-details-tool/map-details-tool.component.ts index 1c7b2eb0a4..faa1d35ed8 100644 --- a/packages/integration/src/lib/map/map-details-tool/map-details-tool.component.ts +++ b/packages/integration/src/lib/map/map-details-tool/map-details-tool.component.ts @@ -115,7 +115,7 @@ export class MapDetailsToolComponent implements OnInit { setTimeout(() => { this.delayedShowEmptyMapContent = true; this.cdRef.detectChanges(); - }, 100); + }, 250); } searchEmit() { diff --git a/packages/integration/src/lib/map/map-legend/map-legend-tool.component.ts b/packages/integration/src/lib/map/map-legend/map-legend-tool.component.ts index 1735dc1978..723efc27b7 100644 --- a/packages/integration/src/lib/map/map-legend/map-legend-tool.component.ts +++ b/packages/integration/src/lib/map/map-legend/map-legend-tool.component.ts @@ -6,8 +6,8 @@ import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core'; -import { Observable, Subscription, BehaviorSubject, ReplaySubject } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { Observable, Subscription, BehaviorSubject, ReplaySubject, combineLatest } from 'rxjs'; +import { map, debounceTime } from 'rxjs/operators'; import { ToolComponent } from '@igo2/common'; import { @@ -99,15 +99,20 @@ export class MapLegendToolComponent implements OnInit, OnDestroy { ) {} ngOnInit(): void { - this.resolution$$ = this.map.viewController.resolution$.subscribe(r => - this.layers$.next( - this.map.layers.filter( - layer => - layer.showInLayerList !== false && - (!this.excludeBaseLayers || !layer.baseLayer) - ) - ) - ); + this.resolution$$ = combineLatest([ + this.map.layers$, + this.map.viewController.resolution$ + ]) + .pipe(debounceTime(10)) + .subscribe((bunch: [Layer[], number]) => { + this.layers$.next( + bunch[0].filter( + layer => + layer.showInLayerList !== false && + (!this.excludeBaseLayers || !layer.baseLayer) + ) + ); + }); this.mapState.showAllLegendsValue = this.mapState.showAllLegendsValue !== undefined @@ -119,7 +124,7 @@ export class MapLegendToolComponent implements OnInit, OnDestroy { setTimeout(() => { this.delayedShowEmptyMapContent = true; this.cdRef.detectChanges(); - }, 100); + }, 250); } onShowAllLegends(event) { diff --git a/packages/integration/src/lib/map/map-tools/map-tools.component.ts b/packages/integration/src/lib/map/map-tools/map-tools.component.ts index 6c8a1e1998..c25849a200 100644 --- a/packages/integration/src/lib/map/map-tools/map-tools.component.ts +++ b/packages/integration/src/lib/map/map-tools/map-tools.component.ts @@ -184,7 +184,7 @@ export class MapToolsComponent implements OnInit, OnDestroy { this.showAllLegendsValue$.next(this.mapState.showAllLegendsValue); // prevent message to be shown too quickly. Waiting for layers - setTimeout(() => (this.delayedShowEmptyMapContent = true), 100); + setTimeout(() => (this.delayedShowEmptyMapContent = true), 250); } ngOnDestroy(): void {