fix Escape clear drawing

This commit is contained in:
Sanster 2022-04-24 21:41:04 +08:00
parent dad1276ea7
commit bbeefba7c5

View File

@ -182,11 +182,6 @@ export default function Editor(props: EditorProps) {
[original, renders, draw] [original, renders, draw]
) )
const clearDrawing = () => {
setIsDraging(false)
setCurLineGroup([])
}
const handleMultiStrokeKeyDown = () => { const handleMultiStrokeKeyDown = () => {
if (isInpaintingLoading) { if (isInpaintingLoading) {
return return
@ -306,7 +301,9 @@ export default function Editor(props: EditorProps) {
return return
} }
if (isDraging || isMultiStrokeKeyPressed) { if (isDraging || isMultiStrokeKeyPressed) {
clearDrawing() setIsDraging(false)
setCurLineGroup([])
drawOnCurrentRender([])
} else { } else {
resetZoom() resetZoom()
} }
@ -323,7 +320,7 @@ export default function Editor(props: EditorProps) {
isInpaintingLoading, isInpaintingLoading,
isMultiStrokeKeyPressed, isMultiStrokeKeyPressed,
resetZoom, resetZoom,
clearDrawing, drawOnCurrentRender,
] ]
) )