From 13f3bcae518a46206e160fcd0d2e6c2fe932667e Mon Sep 17 00:00:00 2001 From: "massimo.ferraro" Date: Fri, 11 Oct 2024 12:47:50 +0200 Subject: [PATCH] Fix issue with panzoom Signed-off-by: massimo.ferraro --- .../network-area-diagram-viewer.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/components/network-area-diagram-viewer/network-area-diagram-viewer.ts b/src/components/network-area-diagram-viewer/network-area-diagram-viewer.ts index 382c93ca..792dbb36 100644 --- a/src/components/network-area-diagram-viewer/network-area-diagram-viewer.ts +++ b/src/components/network-area-diagram-viewer/network-area-diagram-viewer.ts @@ -403,18 +403,21 @@ export class NetworkAreaDiagramViewer { } private handleEndDragSelectEvent(event: Event) { - if (!this.shiftKeyOnMouseDown) { - // moving node - const newPosition = this.getMousePosition(event as MouseEvent); - this.completeDrag(newPosition, true); - } else { - // selecting node - this.completeSelect(); + // check if I moved or selected an element + if (this.selectedElement) { + if (!this.shiftKeyOnMouseDown) { + // moving node + const newPosition = this.getMousePosition(event as MouseEvent); + this.completeDrag(newPosition, true); + } else { + // selecting node + this.completeSelect(); + } + // change cursor style + const svg: HTMLElement = this.svgDraw?.node.firstElementChild?.parentElement; + svg.style.removeProperty('cursor'); + this.enablePanzoom(); } - // change cursor style - const svg: HTMLElement = this.svgDraw?.node.firstElementChild?.parentElement; - svg.style.removeProperty('cursor'); - this.enablePanzoom(); } private completeDrag(newPosition: Point, callMoveNodeCallback: boolean) {