refactor: Update generic constraint Point to use GenericPoint

- Changed existing generic constraints that used LocalPoint | GlobalPoint as Point to now use the unified GenericPoint type.
This commit is contained in:
sunub 2025-04-17 13:16:35 +09:00
parent 71e55dba9f
commit 85cb973936
21 changed files with 153 additions and 211 deletions

View file

@ -9,6 +9,7 @@ import {
vectorCross,
vectorFromPoint,
vectorScale,
type GenericPoint,
type GlobalPoint,
type LocalPoint,
} from "@excalidraw/math";
@ -1642,7 +1643,7 @@ const pathTo = (start: Node, node: Node) => {
return path;
};
const m_dist = (a: GlobalPoint | LocalPoint, b: GlobalPoint | LocalPoint) =>
const m_dist = (a: GenericPoint, b: GenericPoint) =>
Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]);
/**
@ -2291,7 +2292,7 @@ const getHoveredElement = (
const gridAddressesEqual = (a: GridAddress, b: GridAddress): boolean =>
a[0] === b[0] && a[1] === b[1];
export const validateElbowPoints = <P extends GlobalPoint | LocalPoint>(
export const validateElbowPoints = <P extends GenericPoint>(
points: readonly P[],
tolerance: number = DEDUP_TRESHOLD,
) =>