2021-05-28 21:15:40 +00:00
|
|
|
import { Data, ShapeType } from 'types'
|
|
|
|
import shapeUtils from 'lib/shape-utils'
|
2021-05-26 21:47:46 +00:00
|
|
|
|
2021-05-28 21:15:40 +00:00
|
|
|
export const defaultDocument: Data['document'] = {
|
2021-05-10 12:16:57 +00:00
|
|
|
pages: {
|
2021-06-03 12:20:34 +00:00
|
|
|
page1: {
|
|
|
|
id: 'page1',
|
2021-05-28 21:15:40 +00:00
|
|
|
type: 'page',
|
2021-06-03 12:20:34 +00:00
|
|
|
name: 'Page 1',
|
2021-05-10 12:16:57 +00:00
|
|
|
childIndex: 0,
|
|
|
|
shapes: {
|
2021-06-02 11:50:34 +00:00
|
|
|
// arrowShape0: shapeUtils[ShapeType.Arrow].create({
|
|
|
|
// id: 'arrowShape0',
|
|
|
|
// point: [200, 200],
|
|
|
|
// points: [
|
|
|
|
// [0, 0],
|
|
|
|
// [200, 200],
|
|
|
|
// ],
|
|
|
|
// }),
|
|
|
|
// arrowShape1: shapeUtils[ShapeType.Arrow].create({
|
|
|
|
// id: 'arrowShape1',
|
|
|
|
// point: [100, 100],
|
|
|
|
// points: [
|
|
|
|
// [0, 0],
|
|
|
|
// [300, 0],
|
|
|
|
// ],
|
|
|
|
// }),
|
2021-05-31 19:13:43 +00:00
|
|
|
// shape3: shapeUtils[ShapeType.Dot].create({
|
|
|
|
// id: 'shape3',
|
|
|
|
// name: 'Shape 3',
|
|
|
|
// childIndex: 3,
|
|
|
|
// point: [400, 500],
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.lightGray,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// shape0: shapeUtils[ShapeType.Circle].create({
|
|
|
|
// id: 'shape0',
|
|
|
|
// name: 'Shape 0',
|
|
|
|
// childIndex: 1,
|
|
|
|
// point: [100, 600],
|
|
|
|
// radius: 50,
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.lightGray,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// shape5: shapeUtils[ShapeType.Ellipse].create({
|
|
|
|
// id: 'shape5',
|
|
|
|
// name: 'Shape 5',
|
|
|
|
// childIndex: 5,
|
|
|
|
// point: [200, 200],
|
|
|
|
// radiusX: 50,
|
|
|
|
// radiusY: 100,
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.lightGray,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// shape7: shapeUtils[ShapeType.Ellipse].create({
|
|
|
|
// id: 'shape7',
|
|
|
|
// name: 'Shape 7',
|
|
|
|
// childIndex: 7,
|
|
|
|
// point: [100, 100],
|
|
|
|
// radiusX: 50,
|
|
|
|
// radiusY: 30,
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.lightGray,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// shape6: shapeUtils[ShapeType.Line].create({
|
|
|
|
// id: 'shape6',
|
|
|
|
// name: 'Shape 6',
|
|
|
|
// childIndex: 1,
|
|
|
|
// point: [400, 400],
|
|
|
|
// direction: [0.2, 0.2],
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.lightGray,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// rayShape: shapeUtils[ShapeType.Ray].create({
|
|
|
|
// id: 'rayShape',
|
|
|
|
// name: 'Ray',
|
|
|
|
// childIndex: 3,
|
|
|
|
// point: [300, 100],
|
|
|
|
// direction: [0.5, 0.5],
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.lightGray,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// shape2: shapeUtils[ShapeType.Polyline].create({
|
|
|
|
// id: 'shape2',
|
|
|
|
// name: 'Shape 2',
|
|
|
|
// childIndex: 2,
|
|
|
|
// point: [200, 600],
|
|
|
|
// points: [
|
|
|
|
// [0, 0],
|
|
|
|
// [75, 200],
|
|
|
|
// [100, 50],
|
|
|
|
// ],
|
|
|
|
// style: {
|
|
|
|
// stroke: shades.black,
|
|
|
|
// fill: shades.none,
|
|
|
|
// strokeWidth: 1,
|
|
|
|
// },
|
|
|
|
// }),
|
2021-06-04 16:08:43 +00:00
|
|
|
// Groups Testing
|
|
|
|
shapeA: shapeUtils[ShapeType.Rectangle].create({
|
|
|
|
id: 'shapeA',
|
|
|
|
name: 'Shape A',
|
|
|
|
childIndex: 1,
|
|
|
|
point: [0, 0],
|
|
|
|
size: [200, 200],
|
|
|
|
parentId: 'groupA',
|
|
|
|
}),
|
|
|
|
shapeB: shapeUtils[ShapeType.Rectangle].create({
|
|
|
|
id: 'shapeB',
|
|
|
|
name: 'Shape B',
|
|
|
|
childIndex: 2,
|
|
|
|
point: [220, 100],
|
|
|
|
size: [200, 200],
|
|
|
|
parentId: 'groupA',
|
|
|
|
}),
|
|
|
|
groupA: shapeUtils[ShapeType.Group].create({
|
|
|
|
id: 'groupA',
|
|
|
|
name: 'Group A',
|
|
|
|
childIndex: 2,
|
|
|
|
point: [0, 0],
|
|
|
|
size: [420, 300],
|
|
|
|
parentId: 'page1',
|
|
|
|
children: ['shapeA', 'shapeB'],
|
|
|
|
}),
|
2021-05-10 12:16:57 +00:00
|
|
|
},
|
|
|
|
},
|
2021-06-03 12:20:34 +00:00
|
|
|
page2: {
|
|
|
|
id: 'page2',
|
2021-06-03 12:06:39 +00:00
|
|
|
type: 'page',
|
2021-06-03 12:20:34 +00:00
|
|
|
name: 'Page 2',
|
2021-06-03 12:06:39 +00:00
|
|
|
childIndex: 1,
|
|
|
|
shapes: {},
|
|
|
|
},
|
2021-05-10 12:16:57 +00:00
|
|
|
},
|
2021-05-14 22:56:41 +00:00
|
|
|
code: {
|
|
|
|
file0: {
|
2021-05-28 21:15:40 +00:00
|
|
|
id: 'file0',
|
|
|
|
name: 'index.ts',
|
2021-05-15 13:02:13 +00:00
|
|
|
code: `
|
|
|
|
new Dot({
|
2021-05-17 10:01:11 +00:00
|
|
|
point: new Vector(0, 0),
|
2021-05-15 13:02:13 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
new Circle({
|
2021-05-17 10:01:11 +00:00
|
|
|
point: new Vector(200, 0),
|
2021-05-15 13:02:13 +00:00
|
|
|
radius: 50,
|
|
|
|
})
|
|
|
|
|
|
|
|
new Ellipse({
|
2021-05-17 10:01:11 +00:00
|
|
|
point: new Vector(400, 0),
|
2021-05-15 13:02:13 +00:00
|
|
|
radiusX: 50,
|
|
|
|
radiusY: 75
|
|
|
|
})
|
|
|
|
|
|
|
|
new Rectangle({
|
2021-05-17 10:01:11 +00:00
|
|
|
point: new Vector(0, 300),
|
2021-05-15 13:02:13 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
new Line({
|
2021-05-17 10:01:11 +00:00
|
|
|
point: new Vector(200, 300),
|
|
|
|
direction: new Vector(1,0.2)
|
2021-05-15 13:02:13 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
new Polyline({
|
2021-05-17 10:01:11 +00:00
|
|
|
point: new Vector(400, 300),
|
|
|
|
points: [new Vector(0, 200), new Vector(0,0), new Vector(200, 200), new Vector(200, 0)],
|
2021-05-15 13:02:13 +00:00
|
|
|
})
|
|
|
|
`,
|
2021-05-14 22:56:41 +00:00
|
|
|
},
|
|
|
|
},
|
2021-05-10 12:16:57 +00:00
|
|
|
}
|