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

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