From 843b408565a471fafa191f1a5363d9beedb76d0f Mon Sep 17 00:00:00 2001 From: Filip Leitner Date: Sun, 20 Oct 2024 17:28:01 +0200 Subject: [PATCH] refactor(layermanager): Use options object for sortByZ folder function --- .../layer-folder-widget/layer-folder-widget.component.ts | 4 +++- .../services/layer-manager/layer-manager-folder.service.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/hslayers/components/layer-manager/widgets/layer-folder-widget/layer-folder-widget.component.ts b/projects/hslayers/components/layer-manager/widgets/layer-folder-widget/layer-folder-widget.component.ts index 47b7a45eec..766406ece1 100644 --- a/projects/hslayers/components/layer-manager/widgets/layer-folder-widget/layer-folder-widget.component.ts +++ b/projects/hslayers/components/layer-manager/widgets/layer-folder-widget/layer-folder-widget.component.ts @@ -65,6 +65,8 @@ export class HsLayerFolderWidgetComponent extends HsLayerEditorWidgetBaseCompone this.folderService.folderAction$.next( this.folderService.addLayer(this.hsLayerSelectorService.currentLayer), ); - this.folderService.folderAction$.next(this.folderService.sortByZ(false)); + this.folderService.folderAction$.next( + this.folderService.sortByZ({debounce: false}), + ); } } diff --git a/projects/hslayers/services/layer-manager/layer-manager-folder.service.ts b/projects/hslayers/services/layer-manager/layer-manager-folder.service.ts index 6728aefcd5..70d0eee5ad 100644 --- a/projects/hslayers/services/layer-manager/layer-manager-folder.service.ts +++ b/projects/hslayers/services/layer-manager/layer-manager-folder.service.ts @@ -60,7 +60,7 @@ export class HsLayerManagerFolderService { private hsConfig: HsConfig, ) { this.sortSubject.pipe(debounceTime(this.sortDebounceTime)).subscribe(() => { - this.folderAction$.next(this.sortByZ(false)); + this.folderAction$.next(this.sortByZ({debounce: false})); }); } @@ -104,11 +104,11 @@ export class HsLayerManagerFolderService { }; } - sortByZ(debounce = true): SortFoldersByZAction { + sortByZ(options = {debounce: true}): SortFoldersByZAction { return { type: FolderActionTypes.SORT_BY_Z, lyr: undefined, - debounce: debounce, + debounce: options.debounce, }; }