feat(ui): add support for default values for sliders

This commit is contained in:
psychedelicious 2024-01-03 08:16:44 +11:00
parent b4c0dafdc8
commit 06245bc761
44 changed files with 87 additions and 323 deletions

View File

@ -69,7 +69,8 @@ const IAIColorPicker = (props: IAIColorPickerProps) => {
max={255} max={255}
step={1} step={1}
w={numberInputWidth} w={numberInputWidth}
/> defaultValue={90}
/>
</InvControl> </InvControl>
<InvControl label="Green"> <InvControl label="Green">
<InvNumberInput <InvNumberInput
@ -79,7 +80,8 @@ const IAIColorPicker = (props: IAIColorPickerProps) => {
max={255} max={255}
step={1} step={1}
w={numberInputWidth} w={numberInputWidth}
/> defaultValue={90}
/>
</InvControl> </InvControl>
<InvControl label="Blue"> <InvControl label="Blue">
<InvNumberInput <InvNumberInput
@ -89,7 +91,8 @@ const IAIColorPicker = (props: IAIColorPickerProps) => {
max={255} max={255}
step={1} step={1}
w={numberInputWidth} w={numberInputWidth}
/> defaultValue={255}
/>
</InvControl> </InvControl>
<InvControl label="Alpha"> <InvControl label="Alpha">
<InvNumberInput <InvNumberInput
@ -99,6 +102,7 @@ const IAIColorPicker = (props: IAIColorPickerProps) => {
min={0} min={0}
max={1} max={1}
w={numberInputWidth} w={numberInputWidth}
defaultValue={1}
/> />
</InvControl> </InvControl>
</Flex> </Flex>

View File

@ -10,6 +10,7 @@ import { InvNumberInput } from 'common/components/InvNumberInput/InvNumberInput'
import { InvTooltip } from 'common/components/InvTooltip/InvTooltip'; import { InvTooltip } from 'common/components/InvTooltip/InvTooltip';
import { $shift } from 'common/hooks/useGlobalModifiers'; import { $shift } from 'common/hooks/useGlobalModifiers';
import { AnimatePresence } from 'framer-motion'; import { AnimatePresence } from 'framer-motion';
import { isNil } from 'lodash-es';
import { memo, useCallback, useMemo, useState } from 'react'; import { memo, useCallback, useMemo, useState } from 'react';
import { InvSliderMark } from './InvSliderMark'; import { InvSliderMark } from './InvSliderMark';
@ -23,7 +24,8 @@ export const InvSlider = memo((props: InvSliderProps) => {
step: _step = 1, step: _step = 1,
fineStep: _fineStep, fineStep: _fineStep,
onChange, onChange,
onReset, onReset: _onReset,
defaultValue,
formatValue = (v: number) => v.toString(), formatValue = (v: number) => v.toString(),
marks: _marks, marks: _marks,
withThumbTooltip: withTooltip = false, withThumbTooltip: withTooltip = false,
@ -59,6 +61,16 @@ export const InvSlider = memo((props: InvSliderProps) => {
} }
return []; return [];
}, [_marks, formatValue, max, min]); }, [_marks, formatValue, max, min]);
const onReset = useCallback(() => {
if (!isNil(defaultValue)) {
onChange(defaultValue);
}
if (_onReset) {
_onReset();
}
}, [defaultValue, onChange, _onReset]);
return ( return (
<> <>
<ChakraSlider <ChakraSlider
@ -103,6 +115,7 @@ export const InvSlider = memo((props: InvSliderProps) => {
{withNumberInput && ( {withNumberInput && (
<InvNumberInput <InvNumberInput
value={value} value={value}
defaultValue={defaultValue}
min={numberInputMin} min={numberInputMin}
max={numberInputMax} max={numberInputMax}
step={step} step={step}

View File

@ -266,6 +266,7 @@ const IAICanvasToolChooserOptions = () => {
step={1} step={1}
onChange={handleChangeBrushSize} onChange={handleChangeBrushSize}
marks={marks} marks={marks}
defaultValue={50}
/> />
<InvNumberInput <InvNumberInput
value={brushSize} value={brushSize}
@ -273,6 +274,7 @@ const IAICanvasToolChooserOptions = () => {
max={500} max={500}
step={1} step={1}
onChange={handleChangeBrushSize} onChange={handleChangeBrushSize}
defaultValue={50}
/> />
</InvControl> </InvControl>
</Flex> </Flex>

View File

@ -27,9 +27,6 @@ const ParamControlAdapterWeight = ({ id }: ParamControlAdapterWeightProps) => {
}, },
[dispatch, id] [dispatch, id]
); );
const onReset = useCallback(() => {
dispatch(controlAdapterWeightChanged({ id, weight: 1 }));
}, [dispatch, id]);
if (isNil(weight)) { if (isNil(weight)) {
// should never happen // should never happen
@ -46,7 +43,7 @@ const ParamControlAdapterWeight = ({ id }: ParamControlAdapterWeightProps) => {
<InvSlider <InvSlider
value={weight} value={weight}
onChange={onChange} onChange={onChange}
onReset={onReset} defaultValue={1}
min={0} min={0}
max={2} max={2}
step={0.05} step={0.05}
@ -57,12 +54,12 @@ const ParamControlAdapterWeight = ({ id }: ParamControlAdapterWeightProps) => {
<InvNumberInput <InvNumberInput
value={weight} value={weight}
onChange={onChange} onChange={onChange}
onReset={onReset}
min={-1} min={-1}
max={2} max={2}
step={0.05} step={0.05}
fineStep={0.01} fineStep={0.01}
maxW={20} maxW={20}
defaultValue={1}
/> />
</InvControl> </InvControl>
</InvControlGroup> </InvControlGroup>

View File

@ -30,12 +30,6 @@ const CannyProcessor = (props: CannyProcessorProps) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleLowThresholdReset = useCallback(() => {
processorChanged(controlNetId, {
low_threshold: DEFAULTS.low_threshold,
});
}, [controlNetId, processorChanged]);
const handleHighThresholdChanged = useCallback( const handleHighThresholdChanged = useCallback(
(v: number) => { (v: number) => {
processorChanged(controlNetId, { high_threshold: v }); processorChanged(controlNetId, { high_threshold: v });
@ -43,19 +37,13 @@ const CannyProcessor = (props: CannyProcessorProps) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleHighThresholdReset = useCallback(() => {
processorChanged(controlNetId, {
high_threshold: DEFAULTS.high_threshold,
});
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl label={t('controlnet.lowThreshold')} isDisabled={!isEnabled}> <InvControl label={t('controlnet.lowThreshold')} isDisabled={!isEnabled}>
<InvSlider <InvSlider
value={low_threshold} value={low_threshold}
onChange={handleLowThresholdChanged} onChange={handleLowThresholdChanged}
onReset={handleLowThresholdReset} defaultValue={DEFAULTS.low_threshold}
min={0} min={0}
max={255} max={255}
withNumberInput withNumberInput
@ -65,7 +53,7 @@ const CannyProcessor = (props: CannyProcessorProps) => {
<InvSlider <InvSlider
value={high_threshold} value={high_threshold}
onChange={handleHighThresholdChanged} onChange={handleHighThresholdChanged}
onReset={handleHighThresholdReset} defaultValue={DEFAULTS.high_threshold}
min={0} min={0}
max={255} max={255}
withNumberInput withNumberInput

View File

@ -30,12 +30,6 @@ const ColorMapProcessor = (props: ColorMapProcessorProps) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleColorMapTileSizeReset = useCallback(() => {
processorChanged(controlNetId, {
color_map_tile_size: DEFAULTS.color_map_tile_size,
});
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl <InvControl
@ -44,8 +38,8 @@ const ColorMapProcessor = (props: ColorMapProcessorProps) => {
> >
<InvSlider <InvSlider
value={color_map_tile_size} value={color_map_tile_size}
defaultValue={DEFAULTS.color_map_tile_size}
onChange={handleColorMapTileSizeChanged} onChange={handleColorMapTileSizeChanged}
onReset={handleColorMapTileSizeReset}
min={1} min={1}
max={256} max={256}
step={1} step={1}

View File

@ -30,12 +30,6 @@ const ContentShuffleProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionChanged = useCallback( const handleImageResolutionChanged = useCallback(
(v: number) => { (v: number) => {
processorChanged(controlNetId, { image_resolution: v }); processorChanged(controlNetId, { image_resolution: v });
@ -43,12 +37,6 @@ const ContentShuffleProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
const handleWChanged = useCallback( const handleWChanged = useCallback(
(v: number) => { (v: number) => {
processorChanged(controlNetId, { w: v }); processorChanged(controlNetId, { w: v });
@ -56,12 +44,6 @@ const ContentShuffleProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleWReset = useCallback(() => {
processorChanged(controlNetId, {
w: DEFAULTS.w,
});
}, [controlNetId, processorChanged]);
const handleHChanged = useCallback( const handleHChanged = useCallback(
(v: number) => { (v: number) => {
processorChanged(controlNetId, { h: v }); processorChanged(controlNetId, { h: v });
@ -69,12 +51,6 @@ const ContentShuffleProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleHReset = useCallback(() => {
processorChanged(controlNetId, {
h: DEFAULTS.h,
});
}, [controlNetId, processorChanged]);
const handleFChanged = useCallback( const handleFChanged = useCallback(
(v: number) => { (v: number) => {
processorChanged(controlNetId, { f: v }); processorChanged(controlNetId, { f: v });
@ -82,12 +58,6 @@ const ContentShuffleProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleFReset = useCallback(() => {
processorChanged(controlNetId, {
f: DEFAULTS.f,
});
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl <InvControl
@ -96,8 +66,8 @@ const ContentShuffleProcessor = (props: Props) => {
> >
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
defaultValue={DEFAULTS.detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -110,8 +80,8 @@ const ContentShuffleProcessor = (props: Props) => {
> >
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
defaultValue={DEFAULTS.image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -121,8 +91,8 @@ const ContentShuffleProcessor = (props: Props) => {
<InvControl label={t('controlnet.w')} isDisabled={!isEnabled}> <InvControl label={t('controlnet.w')} isDisabled={!isEnabled}>
<InvSlider <InvSlider
value={w} value={w}
defaultValue={DEFAULTS.w}
onChange={handleWChanged} onChange={handleWChanged}
onReset={handleWReset}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -132,8 +102,8 @@ const ContentShuffleProcessor = (props: Props) => {
<InvControl label={t('controlnet.h')} isDisabled={!isEnabled}> <InvControl label={t('controlnet.h')} isDisabled={!isEnabled}>
<InvSlider <InvSlider
value={h} value={h}
defaultValue={DEFAULTS.h}
onChange={handleHChanged} onChange={handleHChanged}
onReset={handleHReset}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -143,8 +113,8 @@ const ContentShuffleProcessor = (props: Props) => {
<InvControl label={t('controlnet.f')} isDisabled={!isEnabled}> <InvControl label={t('controlnet.f')} isDisabled={!isEnabled}>
<InvSlider <InvSlider
value={f} value={f}
defaultValue={DEFAULTS.f}
onChange={handleFChanged} onChange={handleFChanged}
onReset={handleFReset}
min={0} min={0}
max={4096} max={4096}
marks marks

View File

@ -49,18 +49,6 @@ const HedPreprocessor = (props: HedProcessorProps) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl <InvControl
@ -69,8 +57,8 @@ const HedPreprocessor = (props: HedProcessorProps) => {
> >
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
defaultValue={DEFAULTS.detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -84,7 +72,7 @@ const HedPreprocessor = (props: HedProcessorProps) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks

View File

@ -37,18 +37,6 @@ const LineartAnimeProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl <InvControl
@ -57,8 +45,8 @@ const LineartAnimeProcessor = (props: Props) => {
> >
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
defaultValue={DEFAULTS.detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset}
min={0} min={0}
max={4096} max={4096}
withNumberInput withNumberInput
@ -72,7 +60,7 @@ const LineartAnimeProcessor = (props: Props) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
withNumberInput withNumberInput

View File

@ -39,18 +39,6 @@ const LineartProcessor = (props: LineartProcessorProps) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
const handleCoarseChanged = useCallback( const handleCoarseChanged = useCallback(
(e: ChangeEvent<HTMLInputElement>) => { (e: ChangeEvent<HTMLInputElement>) => {
processorChanged(controlNetId, { coarse: e.target.checked }); processorChanged(controlNetId, { coarse: e.target.checked });
@ -67,7 +55,7 @@ const LineartProcessor = (props: LineartProcessorProps) => {
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset} defaultValue={DEFAULTS.detect_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -81,7 +69,7 @@ const LineartProcessor = (props: LineartProcessorProps) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks

View File

@ -37,21 +37,13 @@ const MediapipeFaceProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleMaxFacesReset = useCallback(() => {
processorChanged(controlNetId, { max_faces: DEFAULTS.max_faces });
}, [controlNetId, processorChanged]);
const handleMinConfidenceReset = useCallback(() => {
processorChanged(controlNetId, { min_confidence: DEFAULTS.min_confidence });
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl label={t('controlnet.maxFaces')} isDisabled={!isEnabled}> <InvControl label={t('controlnet.maxFaces')} isDisabled={!isEnabled}>
<InvSlider <InvSlider
value={max_faces} value={max_faces}
onChange={handleMaxFacesChanged} onChange={handleMaxFacesChanged}
onReset={handleMaxFacesReset} defaultValue={DEFAULTS.max_faces}
min={1} min={1}
max={20} max={20}
marks marks
@ -62,7 +54,7 @@ const MediapipeFaceProcessor = (props: Props) => {
<InvSlider <InvSlider
value={min_confidence} value={min_confidence}
onChange={handleMinConfidenceChanged} onChange={handleMinConfidenceChanged}
onReset={handleMinConfidenceReset} defaultValue={DEFAULTS.min_confidence}
min={0} min={0}
max={1} max={1}
step={0.01} step={0.01}

View File

@ -37,21 +37,13 @@ const MidasDepthProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleAMultReset = useCallback(() => {
processorChanged(controlNetId, { a_mult: DEFAULTS.a_mult });
}, [controlNetId, processorChanged]);
const handleBgThReset = useCallback(() => {
processorChanged(controlNetId, { bg_th: DEFAULTS.bg_th });
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl label={t('controlnet.amult')} isDisabled={!isEnabled}> <InvControl label={t('controlnet.amult')} isDisabled={!isEnabled}>
<InvSlider <InvSlider
value={a_mult} value={a_mult}
onChange={handleAMultChanged} onChange={handleAMultChanged}
onReset={handleAMultReset} defaultValue={DEFAULTS.a_mult}
min={0} min={0}
max={20} max={20}
step={0.01} step={0.01}
@ -63,7 +55,7 @@ const MidasDepthProcessor = (props: Props) => {
<InvSlider <InvSlider
value={bg_th} value={bg_th}
onChange={handleBgThChanged} onChange={handleBgThChanged}
onReset={handleBgThReset} defaultValue={DEFAULTS.bg_th}
min={0} min={0}
max={20} max={20}
step={0.01} step={0.01}

View File

@ -51,26 +51,6 @@ const MlsdImageProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
const handleThrDReset = useCallback(() => {
processorChanged(controlNetId, { thr_d: DEFAULTS.thr_d });
}, [controlNetId, processorChanged]);
const handleThrVReset = useCallback(() => {
processorChanged(controlNetId, { thr_v: DEFAULTS.thr_v });
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl <InvControl
@ -80,7 +60,7 @@ const MlsdImageProcessor = (props: Props) => {
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset} defaultValue={DEFAULTS.detect_resolution}
min={0} min={0}
max={4096} max={4096}
marks={marks0to4096} marks={marks0to4096}
@ -94,7 +74,7 @@ const MlsdImageProcessor = (props: Props) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
marks={marks0to4096} marks={marks0to4096}
@ -105,7 +85,7 @@ const MlsdImageProcessor = (props: Props) => {
<InvSlider <InvSlider
value={thr_d} value={thr_d}
onChange={handleThrDChanged} onChange={handleThrDChanged}
onReset={handleThrDReset} defaultValue={DEFAULTS.thr_d}
min={0} min={0}
max={1} max={1}
step={0.01} step={0.01}
@ -117,7 +97,7 @@ const MlsdImageProcessor = (props: Props) => {
<InvSlider <InvSlider
value={thr_v} value={thr_v}
onChange={handleThrVChanged} onChange={handleThrVChanged}
onReset={handleThrVReset} defaultValue={DEFAULTS.thr_v}
min={0} min={0}
max={1} max={1}
step={0.01} step={0.01}

View File

@ -37,18 +37,6 @@ const NormalBaeProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
return ( return (
<ProcessorWrapper> <ProcessorWrapper>
<InvControl <InvControl
@ -58,7 +46,7 @@ const NormalBaeProcessor = (props: Props) => {
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset} defaultValue={DEFAULTS.detect_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -72,7 +60,7 @@ const NormalBaeProcessor = (props: Props) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks

View File

@ -39,18 +39,6 @@ const OpenposeProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
const handleHandAndFaceChanged = useCallback( const handleHandAndFaceChanged = useCallback(
(e: ChangeEvent<HTMLInputElement>) => { (e: ChangeEvent<HTMLInputElement>) => {
processorChanged(controlNetId, { hand_and_face: e.target.checked }); processorChanged(controlNetId, { hand_and_face: e.target.checked });
@ -67,7 +55,7 @@ const OpenposeProcessor = (props: Props) => {
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset} defaultValue={DEFAULTS.detect_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -81,7 +69,7 @@ const OpenposeProcessor = (props: Props) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks

View File

@ -39,18 +39,6 @@ const PidiProcessor = (props: Props) => {
[controlNetId, processorChanged] [controlNetId, processorChanged]
); );
const handleDetectResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
detect_resolution: DEFAULTS.detect_resolution,
});
}, [controlNetId, processorChanged]);
const handleImageResolutionReset = useCallback(() => {
processorChanged(controlNetId, {
image_resolution: DEFAULTS.image_resolution,
});
}, [controlNetId, processorChanged]);
const handleScribbleChanged = useCallback( const handleScribbleChanged = useCallback(
(e: ChangeEvent<HTMLInputElement>) => { (e: ChangeEvent<HTMLInputElement>) => {
processorChanged(controlNetId, { scribble: e.target.checked }); processorChanged(controlNetId, { scribble: e.target.checked });
@ -74,7 +62,7 @@ const PidiProcessor = (props: Props) => {
<InvSlider <InvSlider
value={detect_resolution} value={detect_resolution}
onChange={handleDetectResolutionChanged} onChange={handleDetectResolutionChanged}
onReset={handleDetectResolutionReset} defaultValue={DEFAULTS.detect_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks
@ -88,7 +76,7 @@ const PidiProcessor = (props: Props) => {
<InvSlider <InvSlider
value={image_resolution} value={image_resolution}
onChange={handleImageResolutionChanged} onChange={handleImageResolutionChanged}
onReset={handleImageResolutionReset} defaultValue={DEFAULTS.image_resolution}
min={0} min={0}
max={4096} max={4096}
marks marks

View File

@ -5,14 +5,13 @@ import { InvControl } from 'common/components/InvControl/InvControl';
import { InvSlider } from 'common/components/InvSlider/InvSlider'; import { InvSlider } from 'common/components/InvSlider/InvSlider';
import { import {
maxPromptsChanged, maxPromptsChanged,
maxPromptsReset,
} from 'features/dynamicPrompts/store/dynamicPromptsSlice'; } from 'features/dynamicPrompts/store/dynamicPromptsSlice';
import { memo, useCallback } from 'react'; import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const selector = createMemoizedSelector(stateSelector, (state) => { const selector = createMemoizedSelector(stateSelector, (state) => {
const { maxPrompts, combinatorial } = state.dynamicPrompts; const { maxPrompts, combinatorial } = state.dynamicPrompts;
const { min, sliderMax, inputMax } = const { min, sliderMax, inputMax, initial } =
state.config.sd.dynamicPrompts.maxPrompts; state.config.sd.dynamicPrompts.maxPrompts;
return { return {
@ -20,12 +19,13 @@ const selector = createMemoizedSelector(stateSelector, (state) => {
min, min,
sliderMax, sliderMax,
inputMax, inputMax,
initial,
isDisabled: !combinatorial, isDisabled: !combinatorial,
}; };
}); });
const ParamDynamicPromptsMaxPrompts = () => { const ParamDynamicPromptsMaxPrompts = () => {
const { maxPrompts, min, sliderMax, inputMax, isDisabled } = const { maxPrompts, min, sliderMax, inputMax, initial, isDisabled } =
useAppSelector(selector); useAppSelector(selector);
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
@ -37,10 +37,6 @@ const ParamDynamicPromptsMaxPrompts = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(maxPromptsReset());
}, [dispatch]);
return ( return (
<InvControl <InvControl
label={t('dynamicPrompts.maxPrompts')} label={t('dynamicPrompts.maxPrompts')}
@ -52,8 +48,8 @@ const ParamDynamicPromptsMaxPrompts = () => {
min={min} min={min}
max={sliderMax} max={sliderMax}
value={maxPrompts} value={maxPrompts}
defaultValue={initial}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
marks marks
withNumberInput withNumberInput
numberInputMax={inputMax} numberInputMax={inputMax}

View File

@ -50,10 +50,6 @@ const GallerySettingsPopover = () => {
[dispatch] [dispatch]
); );
const handleResetGalleryImageMinimumWidth = useCallback(() => {
dispatch(setGalleryImageMinimumWidth(64));
}, [dispatch]);
const handleChangeAutoSwitch = useCallback( const handleChangeAutoSwitch = useCallback(
(e: ChangeEvent<HTMLInputElement>) => { (e: ChangeEvent<HTMLInputElement>) => {
dispatch(shouldAutoSwitchChanged(e.target.checked)); dispatch(shouldAutoSwitchChanged(e.target.checked));
@ -86,7 +82,7 @@ const GallerySettingsPopover = () => {
onChange={handleChangeGalleryImageMinimumWidth} onChange={handleChangeGalleryImageMinimumWidth}
min={45} min={45}
max={256} max={256}
onReset={handleResetGalleryImageMinimumWidth} defaultValue={90}
/> />
</InvControl> </InvControl>
<InvControl label={t('gallery.autoSwitchNewImages')}> <InvControl label={t('gallery.autoSwitchNewImages')}>

View File

@ -29,10 +29,6 @@ const ParamHrfStrength = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
const handleHrfStrengthReset = useCallback(() => {
dispatch(setHrfStrength(initial));
}, [dispatch, initial]);
const handleHrfStrengthChange = useCallback( const handleHrfStrengthChange = useCallback(
(v: number) => { (v: number) => {
dispatch(setHrfStrength(v)); dispatch(setHrfStrength(v));
@ -48,10 +44,10 @@ const ParamHrfStrength = () => {
step={step} step={step}
fineStep={fineStep} fineStep={fineStep}
value={hrfStrength} value={hrfStrength}
defaultValue={initial}
onChange={handleHrfStrengthChange} onChange={handleHrfStrengthChange}
marks marks
withNumberInput withNumberInput
onReset={handleHrfStrengthReset}
/> />
</InvControl> </InvControl>
); );

View File

@ -12,7 +12,6 @@ import type { LoRA } from 'features/lora/store/loraSlice';
import { import {
loraRemoved, loraRemoved,
loraWeightChanged, loraWeightChanged,
loraWeightReset,
} from 'features/lora/store/loraSlice'; } from 'features/lora/store/loraSlice';
import { memo, useCallback } from 'react'; import { memo, useCallback } from 'react';
import { FaTrashCan } from 'react-icons/fa6'; import { FaTrashCan } from 'react-icons/fa6';
@ -32,10 +31,6 @@ export const LoRACard = memo((props: LoRACardProps) => {
[dispatch, lora.id] [dispatch, lora.id]
); );
const onReset = useCallback(() => {
dispatch(loraWeightReset(lora.id));
}, [dispatch, lora.id]);
const handleRemoveLora = useCallback(() => { const handleRemoveLora = useCallback(() => {
dispatch(loraRemoved(lora.id)); dispatch(loraRemoved(lora.id));
}, [dispatch, lora.id]); }, [dispatch, lora.id]);
@ -61,8 +56,8 @@ export const LoRACard = memo((props: LoRACardProps) => {
min={-1} min={-1}
max={2} max={2}
step={0.01} step={0.01}
onReset={onReset}
marks={marks} marks={marks}
defaultValue={0.75}
/> />
<InvNumberInput <InvNumberInput
value={lora.weight} value={lora.weight}
@ -72,6 +67,7 @@ export const LoRACard = memo((props: LoRACardProps) => {
step={0.01} step={0.01}
w={20} w={20}
flexShrink={0} flexShrink={0}
defaultValue={0.75}
/> />
</InvCardBody> </InvCardBody>
</InvCard> </InvCard>

View File

@ -22,12 +22,12 @@ const NodeOpacitySlider = () => {
<InvSlider <InvSlider
aria-label={t('nodes.nodeOpacity')} aria-label={t('nodes.nodeOpacity')}
value={nodeOpacity} value={nodeOpacity}
defaultValue={1}
min={0.5} min={0.5}
max={1} max={1}
step={0.01} step={0.01}
onChange={handleChange} onChange={handleChange}
orientation="vertical" orientation="vertical"
defaultValue={30}
h="calc(100% - 0.5rem)" h="calc(100% - 0.5rem)"
/> />
</Flex> </Flex>

View File

@ -17,11 +17,6 @@ const ParamCFGRescaleMultiplier = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(
() => dispatch(setCfgRescaleMultiplier(0)),
[dispatch]
);
return ( return (
<InvControl <InvControl
label={t('parameters.cfgRescaleMultiplier')} label={t('parameters.cfgRescaleMultiplier')}
@ -29,12 +24,12 @@ const ParamCFGRescaleMultiplier = () => {
> >
<InvSlider <InvSlider
value={cfgRescaleMultiplier} value={cfgRescaleMultiplier}
defaultValue={0}
min={0} min={0}
max={0.99} max={0.99}
step={0.1} step={0.1}
fineStep={0.01} fineStep={0.01}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
withNumberInput withNumberInput
marks marks
/> />

View File

@ -24,10 +24,6 @@ const ParamClipSkip = () => {
[dispatch] [dispatch]
); );
const handleClipSkipReset = useCallback(() => {
dispatch(setClipSkip(0));
}, [dispatch]);
const max = useMemo(() => { const max = useMemo(() => {
if (!model) { if (!model) {
return CLIP_SKIP_MAP['sd-1'].maxClip; return CLIP_SKIP_MAP['sd-1'].maxClip;
@ -50,11 +46,11 @@ const ParamClipSkip = () => {
<InvControl label={t('parameters.clipSkip')} feature="clipSkip"> <InvControl label={t('parameters.clipSkip')} feature="clipSkip">
<InvSlider <InvSlider
value={clipSkip} value={clipSkip}
defaultValue={0}
min={0} min={0}
max={max} max={max}
step={1} step={1}
onChange={handleClipSkipChange} onChange={handleClipSkipChange}
onReset={handleClipSkipReset}
withNumberInput withNumberInput
marks={sliderMarks} marks={sliderMarks}
/> />

View File

@ -41,10 +41,6 @@ const ParamBoundingBoxWidth = () => {
[ctx] [ctx]
); );
const onReset = useCallback(() => {
ctx.heightChanged(initial);
}, [ctx, initial]);
return ( return (
<InvControl label={t('parameters.height')} isDisabled={isStaging}> <InvControl label={t('parameters.height')} isDisabled={isStaging}>
<InvSlider <InvSlider
@ -53,8 +49,8 @@ const ParamBoundingBoxWidth = () => {
step={CANVAS_GRID_SIZE_COARSE} step={CANVAS_GRID_SIZE_COARSE}
fineStep={CANVAS_GRID_SIZE_FINE} fineStep={CANVAS_GRID_SIZE_FINE}
value={ctx.height} value={ctx.height}
defaultValue={initial}
onChange={onChange} onChange={onChange}
onReset={onReset}
marks marks
withNumberInput withNumberInput
numberInputMax={4096} numberInputMax={4096}

View File

@ -41,10 +41,6 @@ const ParamBoundingBoxWidth = () => {
[ctx] [ctx]
); );
const onReset = useCallback(() => {
ctx.widthChanged(initial);
}, [ctx, initial]);
return ( return (
<InvControl label={t('parameters.width')} isDisabled={isStaging}> <InvControl label={t('parameters.width')} isDisabled={isStaging}>
<InvSlider <InvSlider
@ -53,8 +49,8 @@ const ParamBoundingBoxWidth = () => {
step={CANVAS_GRID_SIZE_COARSE} step={CANVAS_GRID_SIZE_COARSE}
fineStep={CANVAS_GRID_SIZE_FINE} fineStep={CANVAS_GRID_SIZE_FINE}
value={ctx.width} value={ctx.width}
defaultValue={initial}
onChange={onChange} onChange={onChange}
onReset={onReset}
withNumberInput withNumberInput
numberInputMax={4096} numberInputMax={4096}
marks marks

View File

@ -20,10 +20,6 @@ const ParamCanvasCoherenceSteps = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setCanvasCoherenceSteps(20));
}, [dispatch]);
return ( return (
<InvControl <InvControl
label={t('parameters.coherenceSteps')} label={t('parameters.coherenceSteps')}
@ -34,8 +30,8 @@ const ParamCanvasCoherenceSteps = () => {
max={100} max={100}
step={1} step={1}
value={canvasCoherenceSteps} value={canvasCoherenceSteps}
defaultValue={20}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
withNumberInput withNumberInput
numberInputMax={999} numberInputMax={999}
marks marks

View File

@ -19,9 +19,6 @@ const ParamCanvasCoherenceStrength = () => {
}, },
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setCanvasCoherenceStrength(0.3));
}, [dispatch]);
return ( return (
<InvControl <InvControl
@ -33,8 +30,8 @@ const ParamCanvasCoherenceStrength = () => {
max={1} max={1}
step={0.01} step={0.01}
value={canvasCoherenceStrength} value={canvasCoherenceStrength}
defaultValue={0.75}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
withNumberInput withNumberInput
numberInputMax={999} numberInputMax={999}
marks marks

View File

@ -19,9 +19,6 @@ const ParamMaskBlur = () => {
}, },
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setMaskBlur(16));
}, [dispatch]);
return ( return (
<InvControl label={t('parameters.maskBlur')} feature="compositingBlur"> <InvControl label={t('parameters.maskBlur')} feature="compositingBlur">
@ -29,7 +26,7 @@ const ParamMaskBlur = () => {
min={0} min={0}
max={64} max={64}
value={maskBlur} value={maskBlur}
onReset={handleReset} defaultValue={16}
onChange={handleChange} onChange={handleChange}
marks marks
withNumberInput withNumberInput

View File

@ -30,10 +30,6 @@ const ParamInfillPatchmatchDownscaleSize = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setInfillPatchmatchDownscaleSize(2));
}, [dispatch]);
return ( return (
<InvControl <InvControl
isDisabled={infillMethod !== 'patchmatch'} isDisabled={infillMethod !== 'patchmatch'}
@ -43,10 +39,10 @@ const ParamInfillPatchmatchDownscaleSize = () => {
min={1} min={1}
max={10} max={10}
value={infillPatchmatchDownscaleSize} value={infillPatchmatchDownscaleSize}
defaultValue={1}
onChange={handleChange} onChange={handleChange}
withNumberInput withNumberInput
marks marks
onReset={handleReset}
/> />
</InvControl> </InvControl>
); );

View File

@ -29,10 +29,6 @@ const ParamInfillTileSize = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setInfillTileSize(32));
}, [dispatch]);
return ( return (
<InvControl <InvControl
isDisabled={infillMethod !== 'tile'} isDisabled={infillMethod !== 'tile'}
@ -43,10 +39,10 @@ const ParamInfillTileSize = () => {
max={64} max={64}
numberInputMax={256} numberInputMax={256}
value={infillTileSize} value={infillTileSize}
defaultValue={32}
onChange={handleChange} onChange={handleChange}
withNumberInput withNumberInput
marks marks
onReset={handleReset}
/> />
</InvControl> </InvControl>
); );

View File

@ -46,20 +46,16 @@ const ParamCFGScale = () => {
[dispatch] [dispatch]
); );
const onReset = useCallback(() => {
dispatch(setCfgScale(initial));
}, [dispatch, initial]);
return ( return (
<InvControl label={t('parameters.cfgScale')} feature="paramCFGScale"> <InvControl label={t('parameters.cfgScale')} feature="paramCFGScale">
<InvSlider <InvSlider
value={cfgScale} value={cfgScale}
defaultValue={initial}
min={min} min={min}
max={sliderMax} max={sliderMax}
step={coarseStep} step={coarseStep}
fineStep={fineStep} fineStep={fineStep}
onChange={onChange} onChange={onChange}
onReset={onReset}
withNumberInput withNumberInput
marks={marks} marks={marks}
numberInputMax={inputMax} numberInputMax={inputMax}

View File

@ -44,18 +44,14 @@ export const ParamHeight = memo(() => {
[ctx] [ctx]
); );
const onReset = useCallback(() => {
ctx.heightChanged(initial);
}, [ctx, initial]);
const marks = useMemo(() => [min, initial, max], [min, initial, max]); const marks = useMemo(() => [min, initial, max], [min, initial, max]);
return ( return (
<InvControl label={t('parameters.height')}> <InvControl label={t('parameters.height')}>
<InvSlider <InvSlider
value={ctx.height} value={ctx.height}
defaultValue={initial}
onChange={onChange} onChange={onChange}
onReset={onReset}
min={min} min={min}
max={max} max={max}
step={step} step={step}
@ -69,6 +65,7 @@ export const ParamHeight = memo(() => {
max={inputMax} max={inputMax}
step={step} step={step}
fineStep={fineStep} fineStep={fineStep}
defaultValue={initial}
/> />
</InvControl> </InvControl>
); );

View File

@ -43,10 +43,6 @@ const ParamSteps = () => {
[dispatch] [dispatch]
); );
const onReset = useCallback(() => {
dispatch(setSteps(initial));
}, [dispatch, initial]);
const onBlur = useCallback(() => { const onBlur = useCallback(() => {
dispatch(clampSymmetrySteps()); dispatch(clampSymmetrySteps());
}, [dispatch]); }, [dispatch]);
@ -55,12 +51,12 @@ const ParamSteps = () => {
<InvControl label={t('parameters.steps')} feature="paramSteps"> <InvControl label={t('parameters.steps')} feature="paramSteps">
<InvSlider <InvSlider
value={steps} value={steps}
defaultValue={initial}
min={min} min={min}
max={sliderMax} max={sliderMax}
step={step} step={step}
fineStep={fineStep} fineStep={fineStep}
onChange={onChange} onChange={onChange}
onReset={onReset}
onBlur={onBlur} onBlur={onBlur}
withNumberInput withNumberInput
marks={marks} marks={marks}

View File

@ -43,10 +43,6 @@ export const ParamWidth = memo(() => {
[ctx] [ctx]
); );
const onReset = useCallback(() => {
ctx.widthChanged(initial);
}, [ctx, initial]);
const marks = useMemo(() => [min, initial, max], [min, initial, max]); const marks = useMemo(() => [min, initial, max], [min, initial, max]);
return ( return (
@ -54,7 +50,7 @@ export const ParamWidth = memo(() => {
<InvSlider <InvSlider
value={ctx.width} value={ctx.width}
onChange={onChange} onChange={onChange}
onReset={onReset} defaultValue={initial}
min={min} min={min}
max={max} max={max}
step={step} step={step}
@ -68,6 +64,7 @@ export const ParamWidth = memo(() => {
max={inputMax} max={inputMax}
step={step} step={step}
fineStep={fineStep} fineStep={fineStep}
defaultValue={initial}
/> />
</InvControl> </InvControl>
); );

View File

@ -39,10 +39,6 @@ const ImageToImageStrength = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setImg2imgStrength(initial));
}, [dispatch, initial]);
return ( return (
<InvControl <InvControl
label={`${t('parameters.denoisingStrength')}`} label={`${t('parameters.denoisingStrength')}`}
@ -54,8 +50,8 @@ const ImageToImageStrength = () => {
min={min} min={min}
max={sliderMax} max={sliderMax}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
value={img2imgStrength} value={img2imgStrength}
defaultValue={initial}
marks={marks} marks={marks}
withNumberInput withNumberInput
numberInputMax={inputMax} numberInputMax={inputMax}

View File

@ -31,6 +31,7 @@ export const ParamSeedNumberInput = memo(() => {
onChange={handleChangeSeed} onChange={handleChangeSeed}
value={seed} value={seed}
flexGrow={1} flexGrow={1}
defaultValue={0}
/> />
</InvControl> </InvControl>
); );

View File

@ -23,21 +23,18 @@ const ParamSymmetryHorizontal = () => {
}, },
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setHorizontalSymmetrySteps(0));
}, [dispatch]);
return ( return (
<InvControl label={t('parameters.hSymmetryStep')}> <InvControl label={t('parameters.hSymmetryStep')}>
<InvSlider <InvSlider
value={horizontalSymmetrySteps} value={horizontalSymmetrySteps}
defaultValue={0}
onChange={handleChange} onChange={handleChange}
min={0} min={0}
max={steps} max={steps}
step={1} step={1}
withNumberInput withNumberInput
marks marks
onReset={handleReset}
/> />
</InvControl> </InvControl>
); );

View File

@ -23,21 +23,18 @@ const ParamSymmetryVertical = () => {
}, },
[dispatch] [dispatch]
); );
const handleReset = useCallback(() => {
dispatch(setVerticalSymmetrySteps(0));
}, [dispatch]);
return ( return (
<InvControl label={t('parameters.vSymmetryStep')}> <InvControl label={t('parameters.vSymmetryStep')}>
<InvSlider <InvSlider
value={verticalSymmetrySteps} value={verticalSymmetrySteps}
defaultValue={0}
onChange={handleChange} onChange={handleChange}
min={0} min={0}
max={steps} max={steps}
step={1} step={1}
withNumberInput withNumberInput
marks marks
onReset={handleReset}
/> />
</InvControl> </InvControl>
); );

View File

@ -64,6 +64,7 @@ export const InvokeQueueBackButton = memo(() => {
max={999} max={999}
onChange={handleChange} onChange={handleChange}
value={iterations} value={iterations}
defaultValue={1}
numberInputFieldProps={numberInputFieldProps} numberInputFieldProps={numberInputFieldProps}
pos="absolute" pos="absolute"
insetInlineEnd={0} insetInlineEnd={0}

View File

@ -34,20 +34,16 @@ const ParamSDXLRefinerCFGScale = () => {
[dispatch] [dispatch]
); );
const onReset = useCallback(() => {
dispatch(setRefinerCFGScale(initial));
}, [dispatch, initial]);
return ( return (
<InvControl label={t('sdxl.cfgScale')}> <InvControl label={t('sdxl.cfgScale')}>
<InvSlider <InvSlider
value={refinerCFGScale} value={refinerCFGScale}
defaultValue={initial}
min={min} min={min}
max={sliderMax} max={sliderMax}
step={coarseStep} step={coarseStep}
fineStep={fineStep} fineStep={fineStep}
onChange={onChange} onChange={onChange}
onReset={onReset}
withNumberInput withNumberInput
numberInputMax={inputMax} numberInputMax={inputMax}
marks={marks} marks={marks}

View File

@ -18,11 +18,6 @@ const ParamSDXLRefinerNegativeAestheticScore = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(
() => dispatch(setRefinerNegativeAestheticScore(2.5)),
[dispatch]
);
return ( return (
<InvControl label={t('sdxl.negAestheticScore')}> <InvControl label={t('sdxl.negAestheticScore')}>
<InvSlider <InvSlider
@ -31,8 +26,8 @@ const ParamSDXLRefinerNegativeAestheticScore = () => {
step={0.5} step={0.5}
fineStep={0.1} fineStep={0.1}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
value={refinerNegativeAestheticScore} value={refinerNegativeAestheticScore}
defaultValue={2.5}
withNumberInput withNumberInput
marks marks
/> />

View File

@ -17,11 +17,6 @@ const ParamSDXLRefinerPositiveAestheticScore = () => {
[dispatch] [dispatch]
); );
const handleReset = useCallback(
() => dispatch(setRefinerPositiveAestheticScore(6)),
[dispatch]
);
return ( return (
<InvControl label={t('sdxl.posAestheticScore')}> <InvControl label={t('sdxl.posAestheticScore')}>
<InvSlider <InvSlider
@ -30,8 +25,8 @@ const ParamSDXLRefinerPositiveAestheticScore = () => {
max={10} max={10}
fineStep={0.1} fineStep={0.1}
onChange={handleChange} onChange={handleChange}
onReset={handleReset}
value={refinerPositiveAestheticScore} value={refinerPositiveAestheticScore}
defaultValue={6}
withNumberInput withNumberInput
marks marks
/> />

View File

@ -23,11 +23,6 @@ const ParamSDXLRefinerStart = () => {
); );
const { t } = useTranslation(); const { t } = useTranslation();
const handleReset = useCallback(
() => dispatch(setRefinerStart(0.8)),
[dispatch]
);
return ( return (
<InvControl label={t('sdxl.refinerStart')}> <InvControl label={t('sdxl.refinerStart')}>
<InvSlider <InvSlider
@ -35,7 +30,7 @@ const ParamSDXLRefinerStart = () => {
min={0} min={0}
max={1} max={1}
onChange={handleChange} onChange={handleChange}
onReset={handleReset} defaultValue={0.8}
value={refinerStart} value={refinerStart}
withNumberInput withNumberInput
marks marks

View File

@ -35,20 +35,16 @@ const ParamSDXLRefinerSteps = () => {
[dispatch] [dispatch]
); );
const onReset = useCallback(() => {
dispatch(setRefinerSteps(initial));
}, [dispatch, initial]);
return ( return (
<InvControl label={t('sdxl.steps')}> <InvControl label={t('sdxl.steps')}>
<InvSlider <InvSlider
value={refinerSteps} value={refinerSteps}
defaultValue={initial}
min={min} min={min}
max={sliderMax} max={sliderMax}
step={step} step={step}
fineStep={fineStep} fineStep={fineStep}
onChange={onChange} onChange={onChange}
onReset={onReset}
withNumberInput withNumberInput
marks={marks} marks={marks}
numberInputMax={inputMax} numberInputMax={inputMax}