From 09c7dccc651cdb0caf8ca4eb3355b133286dfac1 Mon Sep 17 00:00:00 2001 From: Mutasem Date: Wed, 3 Nov 2021 18:51:49 +0100 Subject: [PATCH] fix types --- packages/editor-ui/src/Interface.ts | 11 ++++++++++- packages/editor-ui/src/views/canvasHelpers.ts | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 23ca31f793..cc96c2adbc 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -42,7 +42,16 @@ declare module 'jsplumb' { targetNodeName: string, targetOutputIndex: number, }; - connector?: any; + connector?: { + setTargetPos: (pos: XYPosition) => void; + resetTargetPos: () => void; + bounds: { + minX: number; + maxX: number; + minY: number; + maxY: number; + } + }; // bind(event: string, (connection: Connection): void;): void; // tslint:disable-line:no-any bind(event: string, callback: Function): void; diff --git a/packages/editor-ui/src/views/canvasHelpers.ts b/packages/editor-ui/src/views/canvasHelpers.ts index 87fdd99790..fe43ee84de 100644 --- a/packages/editor-ui/src/views/canvasHelpers.ts +++ b/packages/editor-ui/src/views/canvasHelpers.ts @@ -241,7 +241,9 @@ export const showOrHideMidpointArrow = (connection: Connection) => { }; export const getConnectorLengths = (connection: Connection): [number, number] => { - // @ts-ignore + if (!connection.connector) { + return [0, 0]; + } const bounds = connection.connector.bounds; const diffX = Math.abs(bounds.maxX - bounds.minX); const diffY = Math.abs(bounds.maxY - bounds.minY);