mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes bounding box not being rounded to 64
This commit is contained in:
parent
74485411a8
commit
c0005eb063
@ -23,6 +23,7 @@ import {
|
||||
isCanvasBaseImage,
|
||||
isCanvasMaskLine,
|
||||
} from './canvasTypes';
|
||||
import roundDimensionsTo64 from '../util/roundDimensionsTo64';
|
||||
|
||||
export const initialLayerState: CanvasLayerState = {
|
||||
objects: [],
|
||||
@ -180,7 +181,7 @@ export const canvasSlice = createSlice({
|
||||
};
|
||||
},
|
||||
setBoundingBoxDimensions: (state, action: PayloadAction<Dimensions>) => {
|
||||
state.boundingBoxDimensions = action.payload;
|
||||
state.boundingBoxDimensions = roundDimensionsTo64(action.payload);
|
||||
},
|
||||
setBoundingBoxCoordinates: (state, action: PayloadAction<Vector2d>) => {
|
||||
state.boundingBoxCoordinates = floorCoordinates(action.payload);
|
||||
|
11
frontend/src/features/canvas/util/roundDimensionsTo64.ts
Normal file
11
frontend/src/features/canvas/util/roundDimensionsTo64.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { roundToMultiple } from 'common/util/roundDownToMultiple';
|
||||
import { Dimensions } from '../store/canvasTypes';
|
||||
|
||||
const roundDimensionsTo64 = (dimensions: Dimensions): Dimensions => {
|
||||
return {
|
||||
width: roundToMultiple(dimensions.width, 64),
|
||||
height: roundToMultiple(dimensions.height, 64),
|
||||
};
|
||||
};
|
||||
|
||||
export default roundDimensionsTo64;
|
Loading…
Reference in New Issue
Block a user