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 3.6KB

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