diff --git a/__tests__/__snapshots__/project.test.ts.snap b/__tests__/__snapshots__/project.test.ts.snap index 6694455a2..21aa5b5a1 100644 --- a/__tests__/__snapshots__/project.test.ts.snap +++ b/__tests__/__snapshots__/project.test.ts.snap @@ -13267,7 +13267,52 @@ exports[`project mounts the state: data after initial mount 1`] = ` Object { "code": Object { "file0": Object { - "code": "", + "code": " +const draw = new Draw({ + points: [ + [0, 0], + [0, 50], + [20, 80], + [56, 56], + [52, 52], + [80, 20], + [90, 90], + [100, 100], + ], +}) + +const rectangle = new Rectangle({ + point: [200, 0], + style: { + color: ColorStyle.Blue, + }, +}) + +const ellipse = new Ellipse({ + point: [400, 0], +}) + +const arrow = new Arrow({ + start: [600, 0], + end: [700, 100], +}) + +const radius = 1000 +const count = 100 +const center = [350, 50] + +for (let i = 0; i < count; i++) { + const point = Vec.rotWith( + Vec.add(center, [radius, 0]), + center, + (Math.PI * 2 * i) / count + ) + + const dot = new Dot({ + point, + }) +} + ", "id": "file0", "name": "index.ts", }, diff --git a/types.ts b/types.ts index 78706efd7..9750b0741 100644 --- a/types.ts +++ b/types.ts @@ -191,6 +191,12 @@ export interface GroupShape extends BaseShape { size: number[] } +type DeepPartial = { + [P in keyof T]?: DeepPartial +} + +export type ShapeProps = DeepPartial + export type MutableShape = | DotShape | EllipseShape