diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts index dc00a78067..1e7055225e 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasStateApiModule.ts @@ -15,7 +15,7 @@ import { } from 'features/controlLayers/store/canvasSettingsSlice'; import { $lastCanvasProgressEvent, - bboxChanged, + bboxChangedFromCanvas, entityBrushLineAdded, entityEraserLineAdded, entityMoved, @@ -161,7 +161,7 @@ export class CanvasStateApiModule extends CanvasModuleBase { * Sets the generation bbox rect, pushing state to redux. */ setGenerationBbox = (rect: Rect) => { - this.store.dispatch(bboxChanged(rect)); + this.store.dispatch(bboxChangedFromCanvas(rect)); }; /** diff --git a/invokeai/frontend/web/src/features/controlLayers/store/canvasSlice.ts b/invokeai/frontend/web/src/features/controlLayers/store/canvasSlice.ts index 977a718ea3..35136fee30 100644 --- a/invokeai/frontend/web/src/features/controlLayers/store/canvasSlice.ts +++ b/invokeai/frontend/web/src/features/controlLayers/store/canvasSlice.ts @@ -692,14 +692,14 @@ export const canvasSlice = createSlice({ state.bbox.scaleMethod = action.payload; syncScaledSize(state); }, - bboxChanged: (state, action: PayloadAction) => { + bboxChangedFromCanvas: (state, action: PayloadAction) => { state.bbox.rect = action.payload; - if (!state.bbox.aspectRatio.isLocked) { - state.bbox.aspectRatio.value = state.bbox.rect.width / state.bbox.rect.height; - state.bbox.aspectRatio.id = 'Free'; - state.bbox.aspectRatio.isLocked = false; - } + // TODO(psyche): Figure out a way to handle this without resetting the aspect ratio on every change. + // This action is dispatched when the user resizes or moves the bbox from the canvas. For now, when the user + // resizes the bbox from the canvas, we unlock the aspect ratio. + state.bbox.aspectRatio.value = state.bbox.rect.width / state.bbox.rect.height; + state.bbox.aspectRatio.id = 'Free'; syncScaledSize(state); }, @@ -1164,7 +1164,7 @@ export const { // allEntitiesDeleted, // currently unused allEntitiesOfTypeIsHiddenToggled, // bbox - bboxChanged, + bboxChangedFromCanvas, bboxScaledWidthChanged, bboxScaledHeightChanged, bboxScaleMethodChanged,