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.2KB

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