mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes reset canvas view when locked
This commit is contained in:
parent
425d3bc95d
commit
ed70fc683c
@ -439,14 +439,21 @@ export const canvasSlice = createSlice({
|
|||||||
const { contentRect } = action.payload;
|
const { contentRect } = action.payload;
|
||||||
|
|
||||||
const baseCanvasImage = state.layerState.objects.find(isCanvasBaseImage);
|
const baseCanvasImage = state.layerState.objects.find(isCanvasBaseImage);
|
||||||
const { shouldLockToInitialImage } = state;
|
const { shouldLockToInitialImage, initialCanvasImageClipRect } = state;
|
||||||
if (!baseCanvasImage) return;
|
if (!baseCanvasImage) return;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
stageDimensions: { width: stageWidth, height: stageHeight },
|
stageDimensions: { width: stageWidth, height: stageHeight },
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
const { x, y, width, height } = contentRect;
|
let { x, y, width, height } = contentRect;
|
||||||
|
|
||||||
|
if (shouldLockToInitialImage && initialCanvasImageClipRect) {
|
||||||
|
x = initialCanvasImageClipRect.clipX;
|
||||||
|
y = initialCanvasImageClipRect.clipY;
|
||||||
|
width = initialCanvasImageClipRect.clipWidth;
|
||||||
|
height = initialCanvasImageClipRect.clipHeight;
|
||||||
|
}
|
||||||
|
|
||||||
const padding = shouldLockToInitialImage ? 1 : 0.95;
|
const padding = shouldLockToInitialImage ? 1 : 0.95;
|
||||||
const newScale = calculateScale(
|
const newScale = calculateScale(
|
||||||
|
Loading…
Reference in New Issue
Block a user