From 0c5380aa7698749144c7e2dc15d3c4f4c0ec26ca Mon Sep 17 00:00:00 2001 From: Henry Fock Date: Thu, 21 Nov 2024 09:58:28 +0100 Subject: [PATCH] [Selection] fix css on window close --- .../selection/selection-controller/ClickController.ts | 2 +- .../selection/selection-controller/DragController.ts | 1 + src/packages/selection/selection-controller/helper.ts | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/packages/selection/selection-controller/ClickController.ts b/src/packages/selection/selection-controller/ClickController.ts index bd985e4a..e5f15225 100644 --- a/src/packages/selection/selection-controller/ClickController.ts +++ b/src/packages/selection/selection-controller/ClickController.ts @@ -40,7 +40,7 @@ export class ClickController { destroy() { this.tooltip.destroy(); unByKey(this.eventKey); - deactivateViewportInteraction(this.olMap); + deactivateViewportInteraction(this.olMap, true); } diff --git a/src/packages/selection/selection-controller/DragController.ts b/src/packages/selection/selection-controller/DragController.ts index ca10f9f5..7458866c 100644 --- a/src/packages/selection/selection-controller/DragController.ts +++ b/src/packages/selection/selection-controller/DragController.ts @@ -57,6 +57,7 @@ export class DragController { this.interactionResources.forEach((interaction) => { interaction.destroy(); }); + deactivateViewportInteraction(this.olMap, true); } setActive(isActive: boolean) { diff --git a/src/packages/selection/selection-controller/helper.ts b/src/packages/selection/selection-controller/helper.ts index 1b4a5b7d..33b66ce3 100644 --- a/src/packages/selection/selection-controller/helper.ts +++ b/src/packages/selection/selection-controller/helper.ts @@ -27,10 +27,11 @@ export function activateViewportInteraction(map: OlMap) { /** * Applies appropriate css classes from the viewport to indicate that the selection process is inactive */ -export function deactivateViewportInteraction(map: OlMap) { +export function deactivateViewportInteraction(map: OlMap, destroy = true) { const viewPort = map.getViewport(); viewPort.classList.remove(ACTIVE_CLASS); - viewPort.classList.add(INACTIVE_CLASS); + if (!destroy) + viewPort.classList.add(INACTIVE_CLASS); } /**