Tldraw/state/data.ts

94 wiersze
2.2 KiB
TypeScript
Czysty Zwykły widok Historia

2021-05-10 12:16:57 +00:00
import { Data, ShapeType } from "types"
2021-05-14 12:44:23 +00:00
import shapeUtils from "lib/shapes"
2021-05-10 12:16:57 +00:00
export const defaultDocument: Data["document"] = {
pages: {
page0: {
id: "page0",
type: "page",
name: "Page 0",
childIndex: 0,
shapes: {
2021-05-14 12:44:23 +00:00
shape3: shapeUtils[ShapeType.Dot].create({
2021-05-12 21:11:17 +00:00
id: "shape3",
name: "Shape 3",
childIndex: 3,
point: [500, 100],
style: {
2021-05-14 21:05:21 +00:00
fill: "#AAA",
2021-05-12 21:11:17 +00:00
stroke: "#777",
strokeWidth: 1,
},
}),
2021-05-14 12:44:23 +00:00
shape0: shapeUtils[ShapeType.Circle].create({
2021-05-10 12:16:57 +00:00
id: "shape0",
name: "Shape 0",
childIndex: 1,
point: [100, 100],
radius: 50,
2021-05-12 21:11:17 +00:00
style: {
2021-05-14 21:05:21 +00:00
fill: "#AAA",
2021-05-12 21:11:17 +00:00
stroke: "#777",
strokeWidth: 1,
},
}),
2021-05-14 12:44:23 +00:00
shape5: shapeUtils[ShapeType.Ellipse].create({
id: "shape5",
name: "Shape 5",
childIndex: 5,
point: [250, 100],
radiusX: 50,
radiusY: 30,
style: {
2021-05-14 21:05:21 +00:00
fill: "#AAA",
2021-05-14 12:44:23 +00:00
stroke: "#777",
strokeWidth: 1,
},
}),
shape2: shapeUtils[ShapeType.Polyline].create({
2021-05-10 12:16:57 +00:00
id: "shape2",
name: "Shape 2",
childIndex: 2,
point: [200, 600],
points: [
[0, 0],
[75, 200],
[100, 50],
],
2021-05-12 21:11:17 +00:00
style: {
fill: "none",
stroke: "#777",
strokeWidth: 2,
2021-05-12 22:14:21 +00:00
strokeLinecap: "round",
strokeLinejoin: "round",
2021-05-12 21:11:17 +00:00
},
}),
2021-05-14 12:44:23 +00:00
shape1: shapeUtils[ShapeType.Rectangle].create({
2021-05-12 21:11:17 +00:00
id: "shape1",
name: "Shape 1",
childIndex: 1,
point: [300, 300],
size: [200, 200],
style: {
2021-05-14 21:05:21 +00:00
fill: "#AAA",
stroke: "#777",
strokeWidth: 1,
},
}),
shape6: shapeUtils[ShapeType.Line].create({
id: "shape6",
name: "Shape 6",
childIndex: 1,
point: [400, 400],
direction: [0.2, 0.2],
style: {
fill: "#AAA",
2021-05-12 21:11:17 +00:00
stroke: "#777",
strokeWidth: 1,
},
}),
2021-05-10 12:16:57 +00:00
},
},
},
}