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 GitHub
parent a977dd1bf5
commit 47ee8a0094
51 changed files with 845 additions and 703 deletions
+9 -6
View File
@@ -34,7 +34,7 @@ import { getTextEditor } from "../queries/dom";
import { arrayToMap } from "../../utils";
import { createTestHook } from "../../components/App";
import type { GlobalPoint, LocalPoint, Radians } from "../../../math";
import { point, pointRotateRads } from "../../../math";
import { pointFrom, pointRotateRads } from "../../../math";
// so that window.h is available when App.tsx is not imported as well.
createTestHook();
@@ -142,7 +142,7 @@ const getElementPointForSelection = (
element: ExcalidrawElement,
): GlobalPoint => {
const { x, y, width, height, angle } = element;
const target = point<GlobalPoint>(
const target = pointFrom<GlobalPoint>(
x +
(isLinearElement(element) || isFreeDrawElement(element) ? 0 : width / 2),
y,
@@ -151,9 +151,12 @@ const getElementPointForSelection = (
if (isLinearElement(element)) {
const bounds = getElementPointsCoords(element, element.points);
center = point((bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2);
center = pointFrom(
(bounds[0] + bounds[2]) / 2,
(bounds[1] + bounds[3]) / 2,
);
} else {
center = point(x + width / 2, y + height / 2);
center = pointFrom(x + width / 2, y + height / 2);
}
if (isTextElement(element)) {
@@ -469,8 +472,8 @@ export class UI {
const width = initialWidth ?? initialHeight ?? size;
const height = initialHeight ?? size;
const points: LocalPoint[] = initialPoints ?? [
point(0, 0),
point(width, height),
pointFrom(0, 0),
pointFrom(width, height),
];
UI.clickTool(type);