From 5ba81d328208be7a2a0f33d0c07e9b10e5b2d69d Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Wed, 10 Apr 2024 10:49:05 +0000 Subject: [PATCH] add circle shape --- src/ui/converters/createPenpotCircle.ts | 1 + src/ui/lib/penpot.d.ts | 3 ++- src/ui/lib/types/circle/circleAttributes.d.ts | 4 ++++ src/ui/lib/types/circle/circleShape.d.ts | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/ui/lib/types/circle/circleAttributes.d.ts create mode 100644 src/ui/lib/types/circle/circleShape.d.ts diff --git a/src/ui/converters/createPenpotCircle.ts b/src/ui/converters/createPenpotCircle.ts index dbc2e27..c38be1f 100644 --- a/src/ui/converters/createPenpotCircle.ts +++ b/src/ui/converters/createPenpotCircle.ts @@ -8,6 +8,7 @@ export const createPenpotCircle = ( baseY: number ) => { file.penpotFile.createCircle({ + type: Symbol.for('circle'), name: node.name, x: node.x + baseX, y: node.y + baseY, diff --git a/src/ui/lib/penpot.d.ts b/src/ui/lib/penpot.d.ts index 5ba398f..2e8cb5c 100644 --- a/src/ui/lib/penpot.d.ts +++ b/src/ui/lib/penpot.d.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +import { CircleShape } from './types/circle/circleShape'; import { TextShape } from './types/text/textShape'; export interface PenpotFile { @@ -11,7 +12,7 @@ export interface PenpotFile { addGroup(group: any): void; closeGroup(): void; createRect(rect: any): void; - createCircle(circle: any): void; + createCircle(circle: CircleShape): void; createText(options: TextShape): void; createImage(image: any): void; } diff --git a/src/ui/lib/types/circle/circleAttributes.d.ts b/src/ui/lib/types/circle/circleAttributes.d.ts new file mode 100644 index 0000000..dad0c53 --- /dev/null +++ b/src/ui/lib/types/circle/circleAttributes.d.ts @@ -0,0 +1,4 @@ +export type CircleAttributes = { + id?: string; + type: symbol; +}; diff --git a/src/ui/lib/types/circle/circleShape.d.ts b/src/ui/lib/types/circle/circleShape.d.ts new file mode 100644 index 0000000..7e29625 --- /dev/null +++ b/src/ui/lib/types/circle/circleShape.d.ts @@ -0,0 +1,4 @@ +import { Shape } from '../shape'; +import { CircleAttributes } from './circleAttributes'; + +export type CircleShape = Shape & CircleAttributes;