mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
refactor(ui): remove unused ellipse & polygon objects
This commit is contained in:
parent
2c5896cb0c
commit
5bec091fd6
@ -536,25 +536,6 @@ const zRectShape = z.object({
|
|||||||
});
|
});
|
||||||
export type RectShape = z.infer<typeof zRectShape>;
|
export type RectShape = z.infer<typeof zRectShape>;
|
||||||
|
|
||||||
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<typeof zEllipseShape>;
|
|
||||||
|
|
||||||
const zPolygonShape = z.object({
|
|
||||||
id: zId,
|
|
||||||
type: z.literal('polygon_shape'),
|
|
||||||
points: zPoints,
|
|
||||||
color: zRgbaColor,
|
|
||||||
});
|
|
||||||
export type PolygonShape = z.infer<typeof zPolygonShape>;
|
|
||||||
|
|
||||||
const zImageObject = z.object({
|
const zImageObject = z.object({
|
||||||
id: zId,
|
id: zId,
|
||||||
type: z.literal('image'),
|
type: z.literal('image'),
|
||||||
@ -566,15 +547,8 @@ const zImageObject = z.object({
|
|||||||
});
|
});
|
||||||
export type ImageObject = z.infer<typeof zImageObject>;
|
export type ImageObject = z.infer<typeof zImageObject>;
|
||||||
|
|
||||||
const zLayerObject = z.discriminatedUnion('type', [
|
const zRenderableObject = z.discriminatedUnion('type', [zImageObject, zBrushLine, zEraserline, zRectShape]);
|
||||||
zImageObject,
|
export type RenderableObject = z.infer<typeof zRenderableObject>;
|
||||||
zBrushLine,
|
|
||||||
zEraserline,
|
|
||||||
zRectShape,
|
|
||||||
zEllipseShape,
|
|
||||||
zPolygonShape,
|
|
||||||
]);
|
|
||||||
export type LayerObject = z.infer<typeof zLayerObject>;
|
|
||||||
|
|
||||||
export const zLayerEntity = z.object({
|
export const zLayerEntity = z.object({
|
||||||
id: zId,
|
id: zId,
|
||||||
@ -585,7 +559,7 @@ export const zLayerEntity = z.object({
|
|||||||
bbox: zRect.nullable(),
|
bbox: zRect.nullable(),
|
||||||
bboxNeedsUpdate: z.boolean(),
|
bboxNeedsUpdate: z.boolean(),
|
||||||
opacity: zOpacity,
|
opacity: zOpacity,
|
||||||
objects: z.array(zLayerObject),
|
objects: z.array(zRenderableObject),
|
||||||
});
|
});
|
||||||
export type LayerEntity = z.infer<typeof zLayerEntity>;
|
export type LayerEntity = z.infer<typeof zLayerEntity>;
|
||||||
|
|
||||||
@ -894,6 +868,6 @@ export type RectShapeAddedArg = { id: string; rect: IRect; color: RgbaColor };
|
|||||||
export type ImageObjectAddedArg = { id: string; imageDTO: ImageDTO };
|
export type ImageObjectAddedArg = { id: string; imageDTO: ImageDTO };
|
||||||
|
|
||||||
//#region Type guards
|
//#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';
|
return obj.type === 'brush_line' || obj.type === 'eraser_line';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user