mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-01 03:01:13 -04:00
fix(ui): new canvas from image places image in bbox correctly
This commit is contained in:
@@ -173,14 +173,11 @@ export const newCanvasFromImage = async (arg: {
|
||||
imageObject = imageDTOToImageObject(imageDTO);
|
||||
}
|
||||
|
||||
const { x, y } = selectBboxRect(state);
|
||||
|
||||
switch (type) {
|
||||
case 'raster_layer': {
|
||||
const overrides = {
|
||||
id: getPrefixedId('raster_layer'),
|
||||
objects: [imageObject],
|
||||
position: { x, y },
|
||||
} satisfies Partial<CanvasRasterLayerState>;
|
||||
dispatch(canvasReset());
|
||||
// The `bboxChangedFromCanvas` reducer does no validation! Careful!
|
||||
@@ -192,7 +189,6 @@ export const newCanvasFromImage = async (arg: {
|
||||
const overrides = {
|
||||
id: getPrefixedId('control_layer'),
|
||||
objects: [imageObject],
|
||||
position: { x, y },
|
||||
controlAdapter: deepClone(initialControlNet),
|
||||
} satisfies Partial<CanvasControlLayerState>;
|
||||
dispatch(canvasReset());
|
||||
@@ -205,7 +201,6 @@ export const newCanvasFromImage = async (arg: {
|
||||
const overrides = {
|
||||
id: getPrefixedId('inpaint_mask'),
|
||||
objects: [imageObject],
|
||||
position: { x, y },
|
||||
} satisfies Partial<CanvasInpaintMaskState>;
|
||||
dispatch(canvasReset());
|
||||
// The `bboxChangedFromCanvas` reducer does no validation! Careful!
|
||||
@@ -217,7 +212,6 @@ export const newCanvasFromImage = async (arg: {
|
||||
const overrides = {
|
||||
id: getPrefixedId('regional_guidance'),
|
||||
objects: [imageObject],
|
||||
position: { x, y },
|
||||
} satisfies Partial<CanvasRegionalGuidanceState>;
|
||||
dispatch(canvasReset());
|
||||
// The `bboxChangedFromCanvas` reducer does no validation! Careful!
|
||||
|
||||
Reference in New Issue
Block a user