mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): entityRasterized action only needs position, not rect
This makes it a bit easier to call the action
This commit is contained in:
committed by
Kent Keirsey
parent
cfb538bdc2
commit
5b8707a74f
@@ -171,11 +171,9 @@ export class CanvasEntityFilterer extends CanvasModuleBase {
|
||||
this.manager.stateApi.rasterizeEntity({
|
||||
entityIdentifier: this.parent.entityIdentifier,
|
||||
imageObject: imageState,
|
||||
rect: {
|
||||
position: {
|
||||
x: Math.round(rect.x),
|
||||
y: Math.round(rect.y),
|
||||
width: imageState.image.height,
|
||||
height: imageState.image.width,
|
||||
},
|
||||
replaceObjects: true,
|
||||
});
|
||||
|
||||
@@ -419,7 +419,7 @@ export class CanvasEntityObjectRenderer extends CanvasModuleBase {
|
||||
this.manager.stateApi.rasterizeEntity({
|
||||
entityIdentifier: this.parent.entityIdentifier,
|
||||
imageObject,
|
||||
rect: { x: Math.round(rect.x), y: Math.round(rect.y), width: imageDTO.width, height: imageDTO.height },
|
||||
position: { x: Math.round(rect.x), y: Math.round(rect.y) },
|
||||
replaceObjects,
|
||||
});
|
||||
this.manager.cache.imageNameCache.set(hash, imageDTO.image_name);
|
||||
|
||||
@@ -950,7 +950,7 @@ export const canvasSlice = createSlice({
|
||||
}
|
||||
},
|
||||
entityRasterized: (state, action: PayloadAction<EntityRasterizedPayload>) => {
|
||||
const { entityIdentifier, imageObject, rect, replaceObjects } = action.payload;
|
||||
const { entityIdentifier, imageObject, position, replaceObjects } = action.payload;
|
||||
const entity = selectEntity(state, entityIdentifier);
|
||||
if (!entity) {
|
||||
return;
|
||||
@@ -959,7 +959,7 @@ export const canvasSlice = createSlice({
|
||||
if (isRenderableEntity(entity)) {
|
||||
if (replaceObjects) {
|
||||
entity.objects = [imageObject];
|
||||
entity.position = { x: rect.x, y: rect.y };
|
||||
entity.position = position;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -353,7 +353,7 @@ export type EntityEraserLineAddedPayload = EntityIdentifierPayload<{ eraserLine:
|
||||
export type EntityRectAddedPayload = EntityIdentifierPayload<{ rect: CanvasRectState }>;
|
||||
export type EntityRasterizedPayload = EntityIdentifierPayload<{
|
||||
imageObject: CanvasImageState;
|
||||
rect: Rect;
|
||||
position: Coordinate;
|
||||
replaceObjects: boolean;
|
||||
}>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user