mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: point()
-> pointFrom()
to fix compiler issue (#8578)
This commit is contained in:
parent
a977dd1bf5
commit
47ee8a0094
51 changed files with 845 additions and 703 deletions
|
@ -57,7 +57,7 @@ import {
|
|||
getNormalizedZoom,
|
||||
} from "../scene";
|
||||
import type { LocalPoint, Radians } from "../../math";
|
||||
import { isFiniteNumber, point } from "../../math";
|
||||
import { isFiniteNumber, pointFrom } from "../../math";
|
||||
|
||||
type RestoredAppState = Omit<
|
||||
AppState,
|
||||
|
@ -268,7 +268,7 @@ const restoreElement = (
|
|||
let y = element.y;
|
||||
let points = // migrate old arrow model to new one
|
||||
!Array.isArray(element.points) || element.points.length < 2
|
||||
? [point(0, 0), point(element.width, element.height)]
|
||||
? [pointFrom(0, 0), pointFrom(element.width, element.height)]
|
||||
: element.points;
|
||||
|
||||
if (points[0][0] !== 0 || points[0][1] !== 0) {
|
||||
|
@ -296,7 +296,7 @@ const restoreElement = (
|
|||
let y: number | undefined = element.y;
|
||||
let points: readonly LocalPoint[] | undefined = // migrate old arrow model to new one
|
||||
!Array.isArray(element.points) || element.points.length < 2
|
||||
? [point(0, 0), point(element.width, element.height)]
|
||||
? [pointFrom(0, 0), pointFrom(element.width, element.height)]
|
||||
: element.points;
|
||||
|
||||
if (points[0][0] !== 0 || points[0][1] !== 0) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { vi } from "vitest";
|
|||
import type { ExcalidrawElementSkeleton } from "./transform";
|
||||
import { convertToExcalidrawElements } from "./transform";
|
||||
import type { ExcalidrawArrowElement } from "../element/types";
|
||||
import { point } from "../../math";
|
||||
import { pointFrom } from "../../math";
|
||||
|
||||
const opts = { regenerateIds: false };
|
||||
|
||||
|
@ -917,7 +917,7 @@ describe("Test Transform", () => {
|
|||
x: 111.262,
|
||||
y: 57,
|
||||
strokeWidth: 2,
|
||||
points: [point(0, 0), point(272.985, 0)],
|
||||
points: [pointFrom(0, 0), pointFrom(272.985, 0)],
|
||||
label: {
|
||||
text: "How are you?",
|
||||
fontSize: 20,
|
||||
|
@ -940,7 +940,7 @@ describe("Test Transform", () => {
|
|||
x: 77.017,
|
||||
y: 79,
|
||||
strokeWidth: 2,
|
||||
points: [point(0, 0)],
|
||||
points: [pointFrom(0, 0)],
|
||||
label: {
|
||||
text: "Friendship",
|
||||
fontSize: 20,
|
||||
|
|
|
@ -54,7 +54,7 @@ import { randomId } from "../random";
|
|||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
import { getLineHeight } from "../fonts";
|
||||
import { isArrowElement } from "../element/typeChecks";
|
||||
import { point, type LocalPoint } from "../../math";
|
||||
import { pointFrom, type LocalPoint } from "../../math";
|
||||
|
||||
export type ValidLinearElement = {
|
||||
type: "arrow" | "line";
|
||||
|
@ -537,7 +537,7 @@ export const convertToExcalidrawElements = (
|
|||
excalidrawElement = newLinearElement({
|
||||
width,
|
||||
height,
|
||||
points: [point(0, 0), point(width, height)],
|
||||
points: [pointFrom(0, 0), pointFrom(width, height)],
|
||||
...element,
|
||||
});
|
||||
|
||||
|
@ -550,7 +550,7 @@ export const convertToExcalidrawElements = (
|
|||
width,
|
||||
height,
|
||||
endArrowhead: "arrow",
|
||||
points: [point(0, 0), point(width, height)],
|
||||
points: [pointFrom(0, 0), pointFrom(width, height)],
|
||||
...element,
|
||||
type: "arrow",
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue