From 97b49f7f5b9e18850ba4c2d17df4ada5043ee401 Mon Sep 17 00:00:00 2001 From: jmacura Date: Sun, 15 Dec 2024 02:05:10 +0100 Subject: [PATCH] fix(cesium): Call signal before loop --- projects/hslayers-cesium/src/hscesium.service.ts | 5 +++-- projects/hslayers/core/hslayers.service.ts | 7 +++++-- projects/hslayers/core/map/map.component.ts | 1 - projects/hslayers/services/event-bus/event-bus.service.ts | 2 +- projects/hslayers/services/map/map.service.ts | 6 +++--- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/projects/hslayers-cesium/src/hscesium.service.ts b/projects/hslayers-cesium/src/hscesium.service.ts index 73a7a02067..b3871f987e 100644 --- a/projects/hslayers-cesium/src/hscesium.service.ts +++ b/projects/hslayers-cesium/src/hscesium.service.ts @@ -229,8 +229,9 @@ export class HsCesiumService { this.cesiumPositionClicked.next(position); }); - //Remove overlays registered when init was called last time (when switching between 2d/3d) - for (const p of this.hsOverlayConstructorService.panels) { + //Remove overlays registered when init was called last time (when switching between 2D/3D) + const panelCollection = this.hsOverlayConstructorService.panels(); + for (const p of panelCollection) { if (this.HsUtilsService.instOf(p, HsQueryPopupComponent)) { this.hsOverlayConstructorService.destroy(p); } diff --git a/projects/hslayers/core/hslayers.service.ts b/projects/hslayers/core/hslayers.service.ts index a42b047da2..be3e9242c9 100644 --- a/projects/hslayers/core/hslayers.service.ts +++ b/projects/hslayers/core/hslayers.service.ts @@ -14,9 +14,11 @@ import {HsLanguageService} from 'hslayers-ng/services/language'; }) export class HslayersService { embeddedEnabled = true; - config: any; + //TODO: remove + //config: any; initCalled: boolean; - missingLRFunctionsWarned: any; + //TODO: remove + //missingLRFunctionsWarned: any; constructor( private hsLanguageService: HsLanguageService, @@ -99,6 +101,7 @@ export class HslayersService { } } else { this.log.log('Map not yet initialized!'); + return; } const neededSize = { width: map.offsetWidth, diff --git a/projects/hslayers/core/map/map.component.ts b/projects/hslayers/core/map/map.component.ts index 4801f31c2f..816b687073 100644 --- a/projects/hslayers/core/map/map.component.ts +++ b/projects/hslayers/core/map/map.component.ts @@ -7,7 +7,6 @@ import { ViewChild, } from '@angular/core'; - import {Subscription} from 'rxjs'; import {transform} from 'ol/proj'; diff --git a/projects/hslayers/services/event-bus/event-bus.service.ts b/projects/hslayers/services/event-bus/event-bus.service.ts index 1c550c6020..6ccd4f4985 100644 --- a/projects/hslayers/services/event-bus/event-bus.service.ts +++ b/projects/hslayers/services/event-bus/event-bus.service.ts @@ -177,7 +177,7 @@ export class HsEventBusService { refreshLaymanLayer: Subject>> = new Subject(); /** - * Fires when WFS filter should be reset - used when last filter is removed + * Fires when WFS filter should be reset - used when last filter is removed */ resetWfsFilter: Subject = new Subject(); constructor() {} diff --git a/projects/hslayers/services/map/map.service.ts b/projects/hslayers/services/map/map.service.ts index 73ecbfe4aa..fc3fd70380 100644 --- a/projects/hslayers/services/map/map.service.ts +++ b/projects/hslayers/services/map/map.service.ts @@ -1,5 +1,6 @@ /* eslint-disable no-eq-null */ import {Injectable, Renderer2, RendererFactory2} from '@angular/core'; +import {filter} from 'rxjs'; import ImageWrapper from 'ol/Image'; import RenderFeature from 'ol/render/Feature'; @@ -48,7 +49,6 @@ import {HsLayoutService} from 'hslayers-ng/services/layout'; import {HsLogService} from 'hslayers-ng/services/log'; import {HsQueuesService} from 'hslayers-ng/services/queues'; import {HsUtilsService} from 'hslayers-ng/services/utils'; -import {filter} from 'rxjs'; import { getDimensions, getEnableProxy, @@ -102,7 +102,7 @@ export class HsMapService { */ originalView: {center: number[]; zoom: number; rotation: number}; /** - * Keeps track of zoomWithModifier listener so its not registered multiple times when using router + * Keeps track of zoomWithModifier listener so it's not registered multiple times when using router */ zoomWithModifierListener; constructor( @@ -347,7 +347,7 @@ export class HsMapService { * @public * @param mapElement - Map html element */ - init(mapElement): void { + init(mapElement: HTMLElement): void { let map: Map; if (this.map) { map = this.map;