fix types

This commit is contained in:
Mutasem 2021-11-03 18:51:49 +01:00
parent 198f9c02c3
commit 09c7dccc65
2 changed files with 13 additions and 2 deletions

View file

@ -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;

View file

@ -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);