mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Visual debugger (#8344)
Add visual debugger to the Excalidraw app (only).
This commit is contained in:
parent
26d2296578
commit
ea7c702cfc
7 changed files with 555 additions and 21 deletions
|
@ -1,7 +1,9 @@
|
|||
import type { LineSegment } from "../../utils";
|
||||
import { ROUNDNESS } from "../constants";
|
||||
import type { ElementOrToolType } from "../types";
|
||||
import type { ElementOrToolType, Point } from "../types";
|
||||
import type { MarkNonNullable } from "../utility-types";
|
||||
import { assertNever } from "../utils";
|
||||
import type { Bounds } from "./bounds";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
|
@ -322,3 +324,23 @@ export const isFixedPointBinding = (
|
|||
): binding is FixedPointBinding => {
|
||||
return binding.fixedPoint != null;
|
||||
};
|
||||
|
||||
// TODO: Move this to @excalidraw/math
|
||||
export const isPoint = (point: unknown): point is Point =>
|
||||
Array.isArray(point) && point.length === 2;
|
||||
|
||||
// TODO: Move this to @excalidraw/math
|
||||
export const isBounds = (box: unknown): box is Bounds =>
|
||||
Array.isArray(box) &&
|
||||
box.length === 4 &&
|
||||
typeof box[0] === "number" &&
|
||||
typeof box[1] === "number" &&
|
||||
typeof box[2] === "number" &&
|
||||
typeof box[3] === "number";
|
||||
|
||||
// TODO: Move this to @excalidraw/math
|
||||
export const isLineSegment = (segment: unknown): segment is LineSegment =>
|
||||
Array.isArray(segment) &&
|
||||
segment.length === 2 &&
|
||||
isPoint(segment[0]) &&
|
||||
isPoint(segment[0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue