From a68c94e8927dfab1ca4b78c5b46e103217ac7fb2 Mon Sep 17 00:00:00 2001 From: jkarkoszka Date: Thu, 18 Jan 2024 07:41:21 +0100 Subject: [PATCH] fix: always correctly position the child vertex of an edge (#307) The position was incorrect for child using relative geometry. Introduce a new const to avoid overriding other const with the same name defined before. This side effect had been introduced during the migration from mxGraph. --- packages/core/src/view/GraphView.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/view/GraphView.ts b/packages/core/src/view/GraphView.ts index 65ed3e3ad..d050cd703 100644 --- a/packages/core/src/view/GraphView.ts +++ b/packages/core/src/view/GraphView.ts @@ -897,11 +897,11 @@ export class GraphView extends EventSource { if (geo.relative && pState) { if (pState.cell.isEdge()) { - const origin = this.getPoint(pState, geo); + const point = this.getPoint(pState, geo); - if (origin) { - origin.x += origin.x / this.scale - pState.origin.x - this.translate.x; - origin.y += origin.y / this.scale - pState.origin.y - this.translate.y; + if (point) { + origin.x += point.x / this.scale - pState.origin.x - this.translate.x; + origin.y += point.y / this.scale - pState.origin.y - this.translate.y; } } else { origin.x += geo.x * pState.unscaledWidth + offset.x;