From 53eb23b8b66a891cdabec402e9214245c5497701 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:07:37 +1000 Subject: [PATCH] fix(ui): fix canvas staging images offset from bounding box The staging area used the stage bbox, not the staging area bbox. --- .../canvas/components/IAICanvasStagingArea.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/invokeai/frontend/web/src/features/canvas/components/IAICanvasStagingArea.tsx b/invokeai/frontend/web/src/features/canvas/components/IAICanvasStagingArea.tsx index fa73f020da..4585ab76af 100644 --- a/invokeai/frontend/web/src/features/canvas/components/IAICanvasStagingArea.tsx +++ b/invokeai/frontend/web/src/features/canvas/components/IAICanvasStagingArea.tsx @@ -3,10 +3,9 @@ import { useAppSelector } from 'app/store/storeHooks'; import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { GroupConfig } from 'konva/lib/Group'; import { isEqual } from 'lodash-es'; - +import { memo } from 'react'; import { Group, Rect } from 'react-konva'; import IAICanvasImage from './IAICanvasImage'; -import { memo } from 'react'; const selector = createSelector( [canvasSelector], @@ -15,11 +14,11 @@ const selector = createSelector( layerState, shouldShowStagingImage, shouldShowStagingOutline, - boundingBoxCoordinates: { x, y }, - boundingBoxDimensions: { width, height }, + boundingBoxCoordinates: stageBoundingBoxCoordinates, + boundingBoxDimensions: stageBoundingBoxDimensions, } = canvas; - const { selectedImageIndex, images } = layerState.stagingArea; + const { selectedImageIndex, images, boundingBox } = layerState.stagingArea; return { currentStagingAreaImage: @@ -30,10 +29,10 @@ const selector = createSelector( isOnLastImage: selectedImageIndex === images.length - 1, shouldShowStagingImage, shouldShowStagingOutline, - x, - y, - width, - height, + x: boundingBox?.x ?? stageBoundingBoxCoordinates.x, + y: boundingBox?.y ?? stageBoundingBoxCoordinates.y, + width: boundingBox?.width ?? stageBoundingBoxDimensions.width, + height: boundingBox?.height ?? stageBoundingBoxDimensions.height, }; }, {