feat(ui): add reset button for control image

This commit is contained in:
psychedelicious 2023-06-07 15:43:11 +10:00
parent 6c2b39d1df
commit ae14adec2a

View File

@ -51,6 +51,9 @@ const ControlNetImagePreview = (props: Props) => {
[controlImage, controlNetId, dispatch] [controlImage, controlNetId, dispatch]
); );
const handleResetControlImage = useCallback(() => {
dispatch(controlNetImageChanged({ controlNetId, controlImage: null }));
}, [controlNetId, dispatch]);
const handleMouseEnter = useCallback(() => { const handleMouseEnter = useCallback(() => {
setIsMouseOverImage(true); setIsMouseOverImage(true);
}, []); }, []);
@ -150,6 +153,22 @@ const ControlNetImagePreview = (props: Props) => {
<IAIImageFallback /> <IAIImageFallback />
</Box> </Box>
)} )}
{controlImage && (
<Flex sx={{ position: 'absolute', top: 0, insetInlineEnd: 0 }}>
<IAIIconButton
aria-label="Reset Control Image"
tooltip="Reset Control Image"
size="sm"
onClick={handleResetControlImage}
icon={<FaUndo />}
variant="link"
sx={{
p: 2,
color: 'base.50',
}}
/>
</Flex>
)}
</Box> </Box>
); );
}; };