From 6720d6c926b747297264b0f9408677ae0143e972 Mon Sep 17 00:00:00 2001 From: ramyma Date: Sun, 18 Aug 2024 16:06:59 +0300 Subject: [PATCH] Make Comfy Soft Inpainting section always visible for img2img & cleanup --- .../ComfySoftInpaintingFields.tsx | 36 +++++++------------ assets/js/src/MainForm/MainForm.tsx | 5 ++- .../src/components/ExpandCollapseCheckbox.tsx | 19 +++++++--- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/assets/js/src/MainForm/ComfySoftInpaintingFields/ComfySoftInpaintingFields.tsx b/assets/js/src/MainForm/ComfySoftInpaintingFields/ComfySoftInpaintingFields.tsx index 45873ad..fe3baab 100644 --- a/assets/js/src/MainForm/ComfySoftInpaintingFields/ComfySoftInpaintingFields.tsx +++ b/assets/js/src/MainForm/ComfySoftInpaintingFields/ComfySoftInpaintingFields.tsx @@ -5,7 +5,6 @@ import { MainFormValues } from "../MainForm"; import ExpandCollapseCheckbox from "../../components/ExpandCollapseCheckbox"; export type ComfySoftInpaintingArgs = { - isEnabled: boolean; maskBlur: number; }; @@ -16,29 +15,20 @@ const SoftInpaintingFields = ({ }) => { return (
- ( - -
- {comfySoftPaintingFields?.map( - ({ value: defaultValue, ...rest }) => ( -
- } - defaultValue={defaultValue} - /> -
- ) - )} + +
+ {comfySoftPaintingFields?.map(({ value: defaultValue, ...rest }) => ( +
+ } + defaultValue={defaultValue} + />
- - )} - defaultValue={false} - /> + ))} +
+
); }; diff --git a/assets/js/src/MainForm/MainForm.tsx b/assets/js/src/MainForm/MainForm.tsx index 103d91a..d5a3467 100644 --- a/assets/js/src/MainForm/MainForm.tsx +++ b/assets/js/src/MainForm/MainForm.tsx @@ -613,7 +613,7 @@ const MainForm = () => { ...(backend === "comfy" && !txt2img && model?.isSdXl ? { fooocus_inpaint } : {}), - ...(backend === "comfy" && comfySoftInpainting.isEnabled + ...(backend === "comfy" && !txt2img ? { mask_blur: comfySoftInpainting.maskBlur } : {}), ultimate_upscale: isUltimateUpscaleEnabled, @@ -773,8 +773,7 @@ const MainForm = () => { (scale != 1 && !(showFullScalePass && fullScalePass)); const showUpscaler = (txt2img && showSecondPassStrength) || !txt2img; const showSoftInpainting = backend === "auto" && !txt2img; - const modalButtonRef = useRef(null); - const [isModalVisible, setIsModalVisible] = useState(false); + return (
( - ({ defaultExpanded = false, label, children, ...props }, ref) => { + ( + { defaultExpanded = false, label, showCheckbox = true, children, ...props }, + ref + ) => { const [expanded, setExpanded] = useState(defaultExpanded); const [prevValue, setPrevValue] = useState(); const contentRef = useRef(null); @@ -49,9 +54,15 @@ const ExpandCollapseCheckbox = forwardRef( className={`p-0 size-8 transition-transform ${expanded ? "rotate-90" : ""}`} />
- - {label} - + {showCheckbox ? ( + + {label} + + ) : ( + + )}