feat(ui): display canvas generation mode in status text

- use the existing logic to determine if generation is txt2img, img2img, inpaint or outpaint
- technically `outpaint` and `inpaint` are the same, just display
"Inpaint" if its either
- debounce this by 1s to prevent jank
This commit is contained in:
psychedelicious
2023-07-23 22:34:31 +10:00
parent 00d3cd4aed
commit 28031ead70
8 changed files with 81 additions and 18 deletions

View File

@ -1,6 +1,5 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { isCanvasMaskLine } from '../store/canvasTypes';
import { CanvasState, isCanvasMaskLine } from '../store/canvasTypes';
import createMaskStage from './createMaskStage';
import { getCanvasBaseLayer, getCanvasStage } from './konvaInstanceProvider';
import { konvaNodeToBlob } from './konvaNodeToBlob';
@ -9,7 +8,7 @@ import { konvaNodeToImageData } from './konvaNodeToImageData';
/**
* Gets Blob and ImageData objects for the base and mask layers
*/
export const getCanvasData = async (state: RootState) => {
export const getCanvasData = async (canvasState: CanvasState) => {
const log = logger('canvas');
const canvasBaseLayer = getCanvasBaseLayer();
@ -26,7 +25,7 @@ export const getCanvasData = async (state: RootState) => {
boundingBoxDimensions,
isMaskEnabled,
shouldPreserveMaskedArea,
} = state.canvas;
} = canvasState;
const boundingBox = {
...boundingBoxCoordinates,

View File

@ -2,11 +2,12 @@ import {
areAnyPixelsBlack,
getImageDataTransparency,
} from 'common/util/arrayBuffer';
import { GenerationMode } from '../store/canvasTypes';
export const getCanvasGenerationMode = (
baseImageData: ImageData,
maskImageData: ImageData
) => {
): GenerationMode => {
const {
isPartiallyTransparent: baseIsPartiallyTransparent,
isFullyTransparent: baseIsFullyTransparent,