From 54289ea66d5f7227f9e379f3b470e347e3823f28 Mon Sep 17 00:00:00 2001 From: Qing Date: Wed, 29 Jun 2022 21:33:33 +0800 Subject: [PATCH] fix graduallyInpainting: alway draw newest lines on mask this can prevent previous result change --- lama_cleaner/app/src/components/Editor/Editor.tsx | 8 ++++++-- lama_cleaner/app/src/store/Atoms.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lama_cleaner/app/src/components/Editor/Editor.tsx b/lama_cleaner/app/src/components/Editor/Editor.tsx index 412a36d..156ca78 100644 --- a/lama_cleaner/app/src/components/Editor/Editor.tsx +++ b/lama_cleaner/app/src/components/Editor/Editor.tsx @@ -129,7 +129,7 @@ export default function Editor(props: EditorProps) { [context, original] ) - const drawAllLinesOnMask = (_lineGroups: LineGroup[]) => { + const drawLinesOnMask = (_lineGroups: LineGroup[]) => { if (!context?.canvas.width || !context?.canvas.height) { throw new Error('canvas has invalid size') } @@ -154,7 +154,11 @@ export default function Editor(props: EditorProps) { setCurLineGroup([]) setIsDraging(false) setIsInpaintingLoading(true) - drawAllLinesOnMask(newLineGroups) + if (settings.graduallyInpainting) { + drawLinesOnMask([curLineGroup]) + } else { + drawLinesOnMask(newLineGroups) + } let targetFile = file if (settings.graduallyInpainting === true && renders.length > 0) { diff --git a/lama_cleaner/app/src/store/Atoms.tsx b/lama_cleaner/app/src/store/Atoms.tsx index 7e98ed9..2b73cb3 100644 --- a/lama_cleaner/app/src/store/Atoms.tsx +++ b/lama_cleaner/app/src/store/Atoms.tsx @@ -49,7 +49,7 @@ export interface Settings { export const settingStateDefault = { show: false, - graduallyInpainting: false, + graduallyInpainting: true, runInpaintingManually: false, model: AIModel.LAMA, ldmSteps: 50,