From de0e48ac5b7cdbd1958f2db9c6ff967200ee4281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Hendrik=20M=C3=BCller?= <44469195+kolibril13@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:56:48 +0200 Subject: [PATCH] compact version --- src/App.jsx | 72 ++++++++--------------------------------------------- 1 file changed, 10 insertions(+), 62 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index eb93eff..f01948f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3,59 +3,16 @@ import "tldraw/tldraw.css"; export default function App() { const handleMount = (editor) => { - const arrowId = createShapeId("arrow"); - const shapes = [ - { - id: createShapeId("rectangle1"), - type: "geo", - x: 22, - y: -47, - props: { - align: "middle", - color: "black", - dash: "draw", - fill: "none", - font: "draw", - geo: "rectangle", - w: 149, - h: 90, - labelColor: "black", - scale: 1, - size: "l", - text: "Color", - }, - }, - { - id: createShapeId("rectangle2"), - type: "geo", - x: 150, - y: 150, - props: { geo: "rectangle", w: 50, h: 50, color: "yellow" }, - }, - { - id: createShapeId("rectangle3"), - type: "geo", - x: 210, - y: 150, - props: { geo: "rectangle", w: 100, h: 75, color: "red" }, - }, - { id: arrowId, type: "arrow", x: 100, y: 100 }, + { id: createShapeId("rectangle1"), type: "geo", x: 22, y: -47, props: { align: "middle", color: "black", dash: "draw", fill: "none", font: "draw", geo: "rectangle", w: 149, h: 90, labelColor: "black", scale: 1, size: "l", text: "Color" } }, + { id: createShapeId("rectangle2"), type: "geo", x: 150, y: 150, props: { geo: "rectangle", w: 50, h: 50, color: "yellow" } }, + { id: createShapeId("rectangle3"), type: "geo", x: 210, y: 150, props: { geo: "rectangle", w: 100, h: 75, color: "red" } }, + { id: createShapeId("arrow"), type: "arrow", x: 100, y: 100 } ]; const bindings = [ - { - fromId: arrowId, - toId: shapes[0].id, - type: "arrow", - props: { terminal: "start", normalizedAnchor: { x: 0.5, y: 0.5 } }, - }, - { - fromId: arrowId, - toId: shapes[1].id, - type: "arrow", - props: { terminal: "end", normalizedAnchor: { x: 0.5, y: 0.5 } }, - }, + { fromId: shapes[3].id, toId: shapes[0].id, type: "arrow", props: { terminal: "start", normalizedAnchor: { x: 0.5, y: 0.5 } } }, + { fromId: shapes[3].id, toId: shapes[1].id, type: "arrow", props: { terminal: "end", normalizedAnchor: { x: 0.5, y: 0.5 } } } ]; editor.createShapes(shapes); @@ -63,17 +20,8 @@ export default function App() { }; return ( - <> -
- -
- +
+ +
); -} +} \ No newline at end of file