From 19f1f07c955a897008dd037e24ea1dd98297a527 Mon Sep 17 00:00:00 2001 From: Qing Date: Thu, 22 Sep 2022 21:40:36 +0800 Subject: [PATCH] SD: remove dice button --- .../app/src/components/Editor/Editor.tsx | 24 ++---------- .../app/src/components/Header/PromptInput.tsx | 2 +- .../src/components/SidePanel/SidePanel.tsx | 37 +++++++------------ lama_cleaner/app/src/event.ts | 1 - lama_cleaner/app/src/store/Atoms.tsx | 3 ++ 5 files changed, 20 insertions(+), 47 deletions(-) diff --git a/lama_cleaner/app/src/components/Editor/Editor.tsx b/lama_cleaner/app/src/components/Editor/Editor.tsx index aabca4d..2c00dd6 100644 --- a/lama_cleaner/app/src/components/Editor/Editor.tsx +++ b/lama_cleaner/app/src/components/Editor/Editor.tsx @@ -41,7 +41,7 @@ import { } from '../../store/Atoms' import useHotKey from '../../hooks/useHotkey' import Croper from '../Croper/Croper' -import emitter, { EVENT_PROMPT, EVENT_RERUN } from '../../event' +import emitter, { EVENT_PROMPT } from '../../event' const TOOLBAR_SIZE = 200 const BRUSH_COLOR = '#ffcc00bb' @@ -309,6 +309,8 @@ export default function Editor(props: EditorProps) { emitter.on(EVENT_PROMPT, () => { if (hadDrawSomething()) { runInpainting(promptVal) + } else if (lastLineGroup.length !== 0) { + runInpainting(promptVal, true) } else { setToastState({ open: true, @@ -323,26 +325,6 @@ export default function Editor(props: EditorProps) { } }, [hadDrawSomething, runInpainting, prompt]) - useEffect(() => { - emitter.on(EVENT_RERUN, () => { - if (hadDrawSomething()) { - runInpainting(promptVal) - } else if (lastLineGroup.length !== 0) { - runInpainting(promptVal, true) - } else { - setToastState({ - open: true, - desc: 'Please draw mask on picture', - state: 'error', - duration: 1500, - }) - } - }) - return () => { - emitter.off(EVENT_RERUN) - } - }, [lastLineGroup, hadDrawSomething, runInpainting, prompt]) - const hadRunInpainting = () => { return renders.length !== 0 } diff --git a/lama_cleaner/app/src/components/Header/PromptInput.tsx b/lama_cleaner/app/src/components/Header/PromptInput.tsx index bd667bc..64b2faa 100644 --- a/lama_cleaner/app/src/components/Header/PromptInput.tsx +++ b/lama_cleaner/app/src/components/Header/PromptInput.tsx @@ -45,7 +45,7 @@ const PromptInput = () => { onClick={handleRepaintClick} disabled={prompt.length === 0 || app.isInpainting} > - RePaint + Dream ) diff --git a/lama_cleaner/app/src/components/SidePanel/SidePanel.tsx b/lama_cleaner/app/src/components/SidePanel/SidePanel.tsx index 15aca9b..1624038 100644 --- a/lama_cleaner/app/src/components/SidePanel/SidePanel.tsx +++ b/lama_cleaner/app/src/components/SidePanel/SidePanel.tsx @@ -7,8 +7,6 @@ import NumberInputSetting from '../Settings/NumberInputSetting' import SettingBlock from '../Settings/SettingBlock' import Selector from '../shared/Selector' import { Switch, SwitchThumb } from '../shared/Switch' -import Button from '../shared/Button' -import emitter, { EVENT_RERUN } from '../../event' const INPUT_WIDTH = 30 @@ -17,10 +15,6 @@ const SidePanel = () => { const [open, toggleOpen] = useToggle(false) const [setting, setSettingState] = useRecoilState(settingState) - const onReRunBtnClick = () => { - emitter.emit(EVENT_RERUN) - } - return (
@@ -103,6 +97,19 @@ const SidePanel = () => { }} /> + { + const val = value.length === 0 ? 0 : parseInt(value, 10) + setSettingState(old => { + return { ...old, sdMaskBlur: val } + }) + }} + /> + { alignItems: 'center', }} > -