You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

data.ts 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import { Data, ShapeType } from 'types'
  2. import shapeUtils from 'lib/shape-utils'
  3. export const defaultDocument: Data['document'] = {
  4. id: '0001',
  5. name: 'My Document',
  6. pages: {
  7. page1: {
  8. id: 'page1',
  9. type: 'page',
  10. name: 'Page 1',
  11. childIndex: 0,
  12. shapes: {
  13. // arrowShape0: shapeUtils[ShapeType.Arrow].create({
  14. // id: 'arrowShape0',
  15. // point: [200, 200],
  16. // points: [
  17. // [0, 0],
  18. // [200, 200],
  19. // ],
  20. // }),
  21. // arrowShape1: shapeUtils[ShapeType.Arrow].create({
  22. // id: 'arrowShape1',
  23. // point: [100, 100],
  24. // points: [
  25. // [0, 0],
  26. // [300, 0],
  27. // ],
  28. // }),
  29. // shape3: shapeUtils[ShapeType.Dot].create({
  30. // id: 'shape3',
  31. // name: 'Shape 3',
  32. // childIndex: 3,
  33. // point: [400, 500],
  34. // style: {
  35. // stroke: shades.black,
  36. // fill: shades.lightGray,
  37. // strokeWidth: 1,
  38. // },
  39. // }),
  40. // shape0: shapeUtils[ShapeType.Circle].create({
  41. // id: 'shape0',
  42. // name: 'Shape 0',
  43. // childIndex: 1,
  44. // point: [100, 600],
  45. // radius: 50,
  46. // style: {
  47. // stroke: shades.black,
  48. // fill: shades.lightGray,
  49. // strokeWidth: 1,
  50. // },
  51. // }),
  52. // shape5: shapeUtils[ShapeType.Ellipse].create({
  53. // id: 'shape5',
  54. // name: 'Shape 5',
  55. // childIndex: 5,
  56. // point: [200, 200],
  57. // radiusX: 50,
  58. // radiusY: 100,
  59. // style: {
  60. // stroke: shades.black,
  61. // fill: shades.lightGray,
  62. // strokeWidth: 1,
  63. // },
  64. // }),
  65. // shape7: shapeUtils[ShapeType.Ellipse].create({
  66. // id: 'shape7',
  67. // name: 'Shape 7',
  68. // childIndex: 7,
  69. // point: [100, 100],
  70. // radiusX: 50,
  71. // radiusY: 30,
  72. // style: {
  73. // stroke: shades.black,
  74. // fill: shades.lightGray,
  75. // strokeWidth: 1,
  76. // },
  77. // }),
  78. // shape6: shapeUtils[ShapeType.Line].create({
  79. // id: 'shape6',
  80. // name: 'Shape 6',
  81. // childIndex: 1,
  82. // point: [400, 400],
  83. // direction: [0.2, 0.2],
  84. // style: {
  85. // stroke: shades.black,
  86. // fill: shades.lightGray,
  87. // strokeWidth: 1,
  88. // },
  89. // }),
  90. // rayShape: shapeUtils[ShapeType.Ray].create({
  91. // id: 'rayShape',
  92. // name: 'Ray',
  93. // childIndex: 3,
  94. // point: [300, 100],
  95. // direction: [0.5, 0.5],
  96. // style: {
  97. // stroke: shades.black,
  98. // fill: shades.lightGray,
  99. // strokeWidth: 1,
  100. // },
  101. // }),
  102. // shape2: shapeUtils[ShapeType.Polyline].create({
  103. // id: 'shape2',
  104. // name: 'Shape 2',
  105. // childIndex: 2,
  106. // point: [200, 600],
  107. // points: [
  108. // [0, 0],
  109. // [75, 200],
  110. // [100, 50],
  111. // ],
  112. // style: {
  113. // stroke: shades.black,
  114. // fill: shades.none,
  115. // strokeWidth: 1,
  116. // },
  117. // }),
  118. // Groups Testing
  119. // shapeA: shapeUtils[ShapeType.Rectangle].create({
  120. // id: 'shapeA',
  121. // name: 'Shape A',
  122. // childIndex: 1,
  123. // point: [0, 0],
  124. // size: [200, 200],
  125. // parentId: 'groupA',
  126. // }),
  127. // shapeB: shapeUtils[ShapeType.Rectangle].create({
  128. // id: 'shapeB',
  129. // name: 'Shape B',
  130. // childIndex: 2,
  131. // point: [220, 100],
  132. // size: [200, 200],
  133. // parentId: 'groupA',
  134. // }),
  135. // groupA: shapeUtils[ShapeType.Group].create({
  136. // id: 'groupA',
  137. // name: 'Group A',
  138. // childIndex: 2,
  139. // point: [0, 0],
  140. // size: [420, 300],
  141. // parentId: 'page1',
  142. // children: ['shapeA', 'shapeB'],
  143. // }),
  144. },
  145. },
  146. page2: {
  147. id: 'page2',
  148. type: 'page',
  149. name: 'Page 2',
  150. childIndex: 1,
  151. shapes: {},
  152. },
  153. },
  154. code: {
  155. file0: {
  156. id: 'file0',
  157. name: 'index.ts',
  158. code: `
  159. new Dot({
  160. point: new Vector(0, 0),
  161. })
  162. new Circle({
  163. point: new Vector(200, 0),
  164. radius: 50,
  165. })
  166. new Ellipse({
  167. point: new Vector(400, 0),
  168. radiusX: 50,
  169. radiusY: 75
  170. })
  171. new Rectangle({
  172. point: new Vector(0, 300),
  173. })
  174. new Line({
  175. point: new Vector(200, 300),
  176. direction: new Vector(1,0.2)
  177. })
  178. new Polyline({
  179. point: new Vector(400, 300),
  180. points: [new Vector(0, 200), new Vector(0,0), new Vector(200, 200), new Vector(200, 0)],
  181. })
  182. `,
  183. },
  184. },
  185. }