aboutsummaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/scene/comparisons.ts
diff options
context:
space:
mode:
authorkj_sh6042026-03-15 16:19:35 -0400
committerkj_sh6042026-03-15 16:19:35 -0400
commit6ec259a0e71174651bae95d4628138bf6fd68742 (patch)
tree5e33c6a5ec091ecabfcb257fdc7b6a88ed8754ac /packages/excalidraw/scene/comparisons.ts
parent16c8578b15c727f22921f8a80a56ee4d4e7f2272 (diff)
refactor: packages/
Diffstat (limited to 'packages/excalidraw/scene/comparisons.ts')
-rw-r--r--packages/excalidraw/scene/comparisons.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/excalidraw/scene/comparisons.ts b/packages/excalidraw/scene/comparisons.ts
new file mode 100644
index 0000000..9af3e66
--- /dev/null
+++ b/packages/excalidraw/scene/comparisons.ts
@@ -0,0 +1,44 @@
+import type { ElementOrToolType } from "../types";
+
+export const hasBackground = (type: ElementOrToolType) =>
+ type === "rectangle" ||
+ type === "iframe" ||
+ type === "embeddable" ||
+ type === "ellipse" ||
+ type === "diamond" ||
+ type === "line" ||
+ type === "freedraw";
+
+export const hasStrokeColor = (type: ElementOrToolType) =>
+ type !== "image" && type !== "frame" && type !== "magicframe";
+
+export const hasStrokeWidth = (type: ElementOrToolType) =>
+ type === "rectangle" ||
+ type === "iframe" ||
+ type === "embeddable" ||
+ type === "ellipse" ||
+ type === "diamond" ||
+ type === "freedraw" ||
+ type === "arrow" ||
+ type === "line";
+
+export const hasStrokeStyle = (type: ElementOrToolType) =>
+ type === "rectangle" ||
+ type === "iframe" ||
+ type === "embeddable" ||
+ type === "ellipse" ||
+ type === "diamond" ||
+ type === "arrow" ||
+ type === "line";
+
+export const canChangeRoundness = (type: ElementOrToolType) =>
+ type === "rectangle" ||
+ type === "iframe" ||
+ type === "embeddable" ||
+ type === "line" ||
+ type === "diamond" ||
+ type === "image";
+
+export const toolIsArrow = (type: ElementOrToolType) => type === "arrow";
+
+export const canHaveArrowheads = (type: ElementOrToolType) => type === "arrow";