Fixes: inpaint canvas not cleared when its src image is deleted

This commit is contained in:
psychedelicious 2022-10-29 23:53:47 +11:00
parent 101fe9efa9
commit e1cb5b8251
6 changed files with 44 additions and 37 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvokeAI - A Stable Diffusion Toolkit</title>
<link rel="shortcut icon" type="icon" href="./assets/favicon.0d253ced.ico" />
<script type="module" crossorigin src="./assets/index.18143ecd.js"></script>
<link rel="stylesheet" href="./assets/index.ff30f6a0.css">
<script type="module" crossorigin src="./assets/index.64b87783.js"></script>
<link rel="stylesheet" href="./assets/index.352e4760.css">
</head>
<body>

View File

@ -33,7 +33,7 @@ import {
setMaskPath,
} from '../../features/options/optionsSlice';
import { requestImages, requestNewImages } from './actions';
import { setImageToInpaint } from '../../features/tabs/Inpainting/inpaintingSlice';
import { clearImageToInpaint, setImageToInpaint } from '../../features/tabs/Inpainting/inpaintingSlice';
/**
* Returns an object containing listener callbacks for socketio events.
@ -271,11 +271,16 @@ const makeSocketIOListeners = (
// remove references to image in options
const { initialImage, maskPath } = getState().options;
const { imageToInpaint } = getState().inpainting;
if (initialImage?.url === url || initialImage === url) {
dispatch(clearInitialImage());
}
if (imageToInpaint?.url === url) {
dispatch(clearImageToInpaint());
}
if (maskPath === url) {
dispatch(setMaskPath(''));
}

View File

@ -94,6 +94,8 @@ const InpaintingCanvas = () => {
dispatch(clearImageToInpaint());
};
image.src = imageToInpaint.url;
} else {
setCanvasBgImage(null)
}
}, [imageToInpaint, dispatch, stageScale, toast]);