refactor: point() -> pointFrom() to fix compiler issue (#8578)

This commit is contained in:
David Luzar 2024-10-01 21:27:17 +02:00 committed by Mark Tolmacs
parent 0c02972695
commit b4d8b04d9e
No known key found for this signature in database
50 changed files with 843 additions and 718 deletions

View file

@ -17,7 +17,7 @@ import { arrayToMap } from "../excalidraw/utils";
import type { LocalPoint } from "../math";
import {
rangeIncludesValue,
point,
pointFrom,
pointRotateRads,
rangeInclusive,
} from "../math";
@ -36,17 +36,17 @@ const getNonLinearElementRelativePoints = (
] => {
if (element.type === "diamond") {
return [
point(element.width / 2, 0),
point(element.width, element.height / 2),
point(element.width / 2, element.height),
point(0, element.height / 2),
pointFrom(element.width / 2, 0),
pointFrom(element.width, element.height / 2),
pointFrom(element.width / 2, element.height),
pointFrom(0, element.height / 2),
];
}
return [
point(0, 0),
point(0 + element.width, 0),
point(0 + element.width, element.height),
point(0, element.height),
pointFrom(0, 0),
pointFrom(0 + element.width, 0),
pointFrom(0 + element.width, element.height),
pointFrom(0, element.height),
];
};
@ -91,7 +91,7 @@ const getRotatedBBox = (element: NonDeletedExcalidrawElement): Bounds => {
const points = getElementRelativePoints(element);
const { cx, cy } = getMinMaxPoints(points);
const centerPoint = point<LocalPoint>(cx, cy);
const centerPoint = pointFrom<LocalPoint>(cx, cy);
const rotatedPoints = points.map((p) =>
pointRotateRads(p, centerPoint, element.angle),