From 5bec091fd62f15b70ed63c532f68ee5a7d772072 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:47:47 +1000 Subject: [PATCH] refactor(ui): remove unused ellipse & polygon objects --- .../src/features/controlLayers/store/types.ts | 34 +++---------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/store/types.ts b/invokeai/frontend/web/src/features/controlLayers/store/types.ts index 16d8284540..0bf9f3bdfe 100644 --- a/invokeai/frontend/web/src/features/controlLayers/store/types.ts +++ b/invokeai/frontend/web/src/features/controlLayers/store/types.ts @@ -536,25 +536,6 @@ const zRectShape = z.object({ }); export type RectShape = z.infer; -const zEllipseShape = z.object({ - id: zId, - type: z.literal('ellipse_shape'), - x: z.number(), - y: z.number(), - width: z.number().min(1), - height: z.number().min(1), - color: zRgbaColor, -}); -export type EllipseShape = z.infer; - -const zPolygonShape = z.object({ - id: zId, - type: z.literal('polygon_shape'), - points: zPoints, - color: zRgbaColor, -}); -export type PolygonShape = z.infer; - const zImageObject = z.object({ id: zId, type: z.literal('image'), @@ -566,15 +547,8 @@ const zImageObject = z.object({ }); export type ImageObject = z.infer; -const zLayerObject = z.discriminatedUnion('type', [ - zImageObject, - zBrushLine, - zEraserline, - zRectShape, - zEllipseShape, - zPolygonShape, -]); -export type LayerObject = z.infer; +const zRenderableObject = z.discriminatedUnion('type', [zImageObject, zBrushLine, zEraserline, zRectShape]); +export type RenderableObject = z.infer; export const zLayerEntity = z.object({ id: zId, @@ -585,7 +559,7 @@ export const zLayerEntity = z.object({ bbox: zRect.nullable(), bboxNeedsUpdate: z.boolean(), opacity: zOpacity, - objects: z.array(zLayerObject), + objects: z.array(zRenderableObject), }); export type LayerEntity = z.infer; @@ -894,6 +868,6 @@ export type RectShapeAddedArg = { id: string; rect: IRect; color: RgbaColor }; export type ImageObjectAddedArg = { id: string; imageDTO: ImageDTO }; //#region Type guards -export const isLine = (obj: LayerObject): obj is BrushLine | EraserLine => { +export const isLine = (obj: RenderableObject): obj is BrushLine | EraserLine => { return obj.type === 'brush_line' || obj.type === 'eraser_line'; };