From 915357a6c18cc421151e12de483a6cce594d3d01 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 6 Jun 2024 18:43:08 +1000 Subject: [PATCH] docs(ui): konva image object docstrings --- .../controlLayers/konva/renderers/objects.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/renderers/objects.ts b/invokeai/frontend/web/src/features/controlLayers/konva/renderers/objects.ts index 5563b7e4d2..b6ca47650c 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/renderers/objects.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/renderers/objects.ts @@ -96,6 +96,11 @@ export const createRectShape = (rectShape: RectShape, layerObjectGroup: Konva.Gr return konvaRect; }; +/** + * Creates an image placeholder group for an image object. + * @param imageObject The image object state + * @returns The konva group for the image placeholder, and callbacks to handle loading and error states + */ const createImagePlaceholderGroup = ( imageObject: ImageObject ): { konvaPlaceholderGroup: Konva.Group; onError: () => void; onLoading: () => void; onLoaded: () => void } => { @@ -134,6 +139,14 @@ const createImagePlaceholderGroup = ( return { konvaPlaceholderGroup, onError, onLoading, onLoaded }; }; +/** + * Creates an image object group. Because images are loaded asynchronously, and we need to handle loading an error state, + * the image is rendered in a group, which includes a placeholder. + * @param imageObject The image object state + * @param layerObjectGroup The konva layer's object group to add the image to + * @param name The konva name for the image + * @returns A promise that resolves to the konva group for the image object + */ export const createImageObjectGroup = async ( imageObject: ImageObject, layerObjectGroup: Konva.Group,