diff --git a/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx b/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx index bf127709ea..adb11ba181 100644 --- a/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx +++ b/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx @@ -69,7 +69,8 @@ const IAIColorPicker = (props: IAIColorPickerProps) => { max={255} step={1} w={numberInputWidth} - /> + defaultValue={90} + /> { max={255} step={1} w={numberInputWidth} - /> + defaultValue={90} + /> { max={255} step={1} w={numberInputWidth} - /> + defaultValue={255} + /> { min={0} max={1} w={numberInputWidth} + defaultValue={1} /> diff --git a/invokeai/frontend/web/src/common/components/InvSlider/InvSlider.tsx b/invokeai/frontend/web/src/common/components/InvSlider/InvSlider.tsx index ba33f22e7e..e68e26b16c 100644 --- a/invokeai/frontend/web/src/common/components/InvSlider/InvSlider.tsx +++ b/invokeai/frontend/web/src/common/components/InvSlider/InvSlider.tsx @@ -10,6 +10,7 @@ import { InvNumberInput } from 'common/components/InvNumberInput/InvNumberInput' import { InvTooltip } from 'common/components/InvTooltip/InvTooltip'; import { $shift } from 'common/hooks/useGlobalModifiers'; import { AnimatePresence } from 'framer-motion'; +import { isNil } from 'lodash-es'; import { memo, useCallback, useMemo, useState } from 'react'; import { InvSliderMark } from './InvSliderMark'; @@ -23,7 +24,8 @@ export const InvSlider = memo((props: InvSliderProps) => { step: _step = 1, fineStep: _fineStep, onChange, - onReset, + onReset: _onReset, + defaultValue, formatValue = (v: number) => v.toString(), marks: _marks, withThumbTooltip: withTooltip = false, @@ -59,6 +61,16 @@ export const InvSlider = memo((props: InvSliderProps) => { } return []; }, [_marks, formatValue, max, min]); + + const onReset = useCallback(() => { + if (!isNil(defaultValue)) { + onChange(defaultValue); + } + if (_onReset) { + _onReset(); + } + }, [defaultValue, onChange, _onReset]); + return ( <> { {withNumberInput && ( { step={1} onChange={handleChangeBrushSize} marks={marks} + defaultValue={50} /> { max={500} step={1} onChange={handleChangeBrushSize} + defaultValue={50} /> diff --git a/invokeai/frontend/web/src/features/controlAdapters/components/parameters/ParamControlAdapterWeight.tsx b/invokeai/frontend/web/src/features/controlAdapters/components/parameters/ParamControlAdapterWeight.tsx index ebfb4c47d0..11f0dca36c 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/components/parameters/ParamControlAdapterWeight.tsx +++ b/invokeai/frontend/web/src/features/controlAdapters/components/parameters/ParamControlAdapterWeight.tsx @@ -27,9 +27,6 @@ const ParamControlAdapterWeight = ({ id }: ParamControlAdapterWeightProps) => { }, [dispatch, id] ); - const onReset = useCallback(() => { - dispatch(controlAdapterWeightChanged({ id, weight: 1 })); - }, [dispatch, id]); if (isNil(weight)) { // should never happen @@ -46,7 +43,7 @@ const ParamControlAdapterWeight = ({ id }: ParamControlAdapterWeightProps) => { { diff --git a/invokeai/frontend/web/src/features/controlAdapters/components/processors/CannyProcessor.tsx b/invokeai/frontend/web/src/features/controlAdapters/components/processors/CannyProcessor.tsx index 70920c95a0..0f0a66ce64 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/components/processors/CannyProcessor.tsx +++ b/invokeai/frontend/web/src/features/controlAdapters/components/processors/CannyProcessor.tsx @@ -30,12 +30,6 @@ const CannyProcessor = (props: CannyProcessorProps) => { [controlNetId, processorChanged] ); - const handleLowThresholdReset = useCallback(() => { - processorChanged(controlNetId, { - low_threshold: DEFAULTS.low_threshold, - }); - }, [controlNetId, processorChanged]); - const handleHighThresholdChanged = useCallback( (v: number) => { processorChanged(controlNetId, { high_threshold: v }); @@ -43,19 +37,13 @@ const CannyProcessor = (props: CannyProcessorProps) => { [controlNetId, processorChanged] ); - const handleHighThresholdReset = useCallback(() => { - processorChanged(controlNetId, { - high_threshold: DEFAULTS.high_threshold, - }); - }, [controlNetId, processorChanged]); - return ( { { [controlNetId, processorChanged] ); - const handleColorMapTileSizeReset = useCallback(() => { - processorChanged(controlNetId, { - color_map_tile_size: DEFAULTS.color_map_tile_size, - }); - }, [controlNetId, processorChanged]); - return ( { > { [controlNetId, processorChanged] ); - const handleDetectResolutionReset = useCallback(() => { - processorChanged(controlNetId, { - detect_resolution: DEFAULTS.detect_resolution, - }); - }, [controlNetId, processorChanged]); - const handleImageResolutionChanged = useCallback( (v: number) => { processorChanged(controlNetId, { image_resolution: v }); @@ -43,12 +37,6 @@ const ContentShuffleProcessor = (props: Props) => { [controlNetId, processorChanged] ); - const handleImageResolutionReset = useCallback(() => { - processorChanged(controlNetId, { - image_resolution: DEFAULTS.image_resolution, - }); - }, [controlNetId, processorChanged]); - const handleWChanged = useCallback( (v: number) => { processorChanged(controlNetId, { w: v }); @@ -56,12 +44,6 @@ const ContentShuffleProcessor = (props: Props) => { [controlNetId, processorChanged] ); - const handleWReset = useCallback(() => { - processorChanged(controlNetId, { - w: DEFAULTS.w, - }); - }, [controlNetId, processorChanged]); - const handleHChanged = useCallback( (v: number) => { processorChanged(controlNetId, { h: v }); @@ -69,12 +51,6 @@ const ContentShuffleProcessor = (props: Props) => { [controlNetId, processorChanged] ); - const handleHReset = useCallback(() => { - processorChanged(controlNetId, { - h: DEFAULTS.h, - }); - }, [controlNetId, processorChanged]); - const handleFChanged = useCallback( (v: number) => { processorChanged(controlNetId, { f: v }); @@ -82,12 +58,6 @@ const ContentShuffleProcessor = (props: Props) => { [controlNetId, processorChanged] ); - const handleFReset = useCallback(() => { - processorChanged(controlNetId, { - f: DEFAULTS.f, - }); - }, [controlNetId, processorChanged]); - return ( { > { > { { { { [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 ( { > { { [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 ( { > { { [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( (e: ChangeEvent) => { processorChanged(controlNetId, { coarse: e.target.checked }); @@ -67,7 +55,7 @@ const LineartProcessor = (props: LineartProcessorProps) => { { { [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 ( { { [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 ( { { [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 ( { { { { { [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 ( { { { [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( (e: ChangeEvent) => { processorChanged(controlNetId, { hand_and_face: e.target.checked }); @@ -67,7 +55,7 @@ const OpenposeProcessor = (props: Props) => { { { [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( (e: ChangeEvent) => { processorChanged(controlNetId, { scribble: e.target.checked }); @@ -74,7 +62,7 @@ const PidiProcessor = (props: Props) => { { { const { maxPrompts, combinatorial } = state.dynamicPrompts; - const { min, sliderMax, inputMax } = + const { min, sliderMax, inputMax, initial } = state.config.sd.dynamicPrompts.maxPrompts; return { @@ -20,12 +19,13 @@ const selector = createMemoizedSelector(stateSelector, (state) => { min, sliderMax, inputMax, + initial, isDisabled: !combinatorial, }; }); const ParamDynamicPromptsMaxPrompts = () => { - const { maxPrompts, min, sliderMax, inputMax, isDisabled } = + const { maxPrompts, min, sliderMax, inputMax, initial, isDisabled } = useAppSelector(selector); const dispatch = useAppDispatch(); const { t } = useTranslation(); @@ -37,10 +37,6 @@ const ParamDynamicPromptsMaxPrompts = () => { [dispatch] ); - const handleReset = useCallback(() => { - dispatch(maxPromptsReset()); - }, [dispatch]); - return ( { min={min} max={sliderMax} value={maxPrompts} + defaultValue={initial} onChange={handleChange} - onReset={handleReset} marks withNumberInput numberInputMax={inputMax} diff --git a/invokeai/frontend/web/src/features/gallery/components/GallerySettingsPopover.tsx b/invokeai/frontend/web/src/features/gallery/components/GallerySettingsPopover.tsx index 597d06a1ba..6b93ca0e03 100644 --- a/invokeai/frontend/web/src/features/gallery/components/GallerySettingsPopover.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/GallerySettingsPopover.tsx @@ -50,10 +50,6 @@ const GallerySettingsPopover = () => { [dispatch] ); - const handleResetGalleryImageMinimumWidth = useCallback(() => { - dispatch(setGalleryImageMinimumWidth(64)); - }, [dispatch]); - const handleChangeAutoSwitch = useCallback( (e: ChangeEvent) => { dispatch(shouldAutoSwitchChanged(e.target.checked)); @@ -86,7 +82,7 @@ const GallerySettingsPopover = () => { onChange={handleChangeGalleryImageMinimumWidth} min={45} max={256} - onReset={handleResetGalleryImageMinimumWidth} + defaultValue={90} /> diff --git a/invokeai/frontend/web/src/features/hrf/components/ParamHrfStrength.tsx b/invokeai/frontend/web/src/features/hrf/components/ParamHrfStrength.tsx index 6ee79fe8fa..274a1a2e8b 100644 --- a/invokeai/frontend/web/src/features/hrf/components/ParamHrfStrength.tsx +++ b/invokeai/frontend/web/src/features/hrf/components/ParamHrfStrength.tsx @@ -29,10 +29,6 @@ const ParamHrfStrength = () => { const dispatch = useAppDispatch(); const { t } = useTranslation(); - const handleHrfStrengthReset = useCallback(() => { - dispatch(setHrfStrength(initial)); - }, [dispatch, initial]); - const handleHrfStrengthChange = useCallback( (v: number) => { dispatch(setHrfStrength(v)); @@ -48,10 +44,10 @@ const ParamHrfStrength = () => { step={step} fineStep={fineStep} value={hrfStrength} + defaultValue={initial} onChange={handleHrfStrengthChange} marks withNumberInput - onReset={handleHrfStrengthReset} /> ); diff --git a/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx b/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx index f5fedcdee3..2e4b3d3c10 100644 --- a/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx +++ b/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx @@ -12,7 +12,6 @@ import type { LoRA } from 'features/lora/store/loraSlice'; import { loraRemoved, loraWeightChanged, - loraWeightReset, } from 'features/lora/store/loraSlice'; import { memo, useCallback } from 'react'; import { FaTrashCan } from 'react-icons/fa6'; @@ -32,10 +31,6 @@ export const LoRACard = memo((props: LoRACardProps) => { [dispatch, lora.id] ); - const onReset = useCallback(() => { - dispatch(loraWeightReset(lora.id)); - }, [dispatch, lora.id]); - const handleRemoveLora = useCallback(() => { dispatch(loraRemoved(lora.id)); }, [dispatch, lora.id]); @@ -61,8 +56,8 @@ export const LoRACard = memo((props: LoRACardProps) => { min={-1} max={2} step={0.01} - onReset={onReset} marks={marks} + defaultValue={0.75} /> { step={0.01} w={20} flexShrink={0} + defaultValue={0.75} /> diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/panels/BottomLeftPanel/NodeOpacitySlider.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/panels/BottomLeftPanel/NodeOpacitySlider.tsx index 96b3c26435..d1195ce9b2 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/panels/BottomLeftPanel/NodeOpacitySlider.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/panels/BottomLeftPanel/NodeOpacitySlider.tsx @@ -22,12 +22,12 @@ const NodeOpacitySlider = () => { diff --git a/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamCFGRescaleMultiplier.tsx b/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamCFGRescaleMultiplier.tsx index daaa7c19d9..c53bd39820 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamCFGRescaleMultiplier.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamCFGRescaleMultiplier.tsx @@ -17,11 +17,6 @@ const ParamCFGRescaleMultiplier = () => { [dispatch] ); - const handleReset = useCallback( - () => dispatch(setCfgRescaleMultiplier(0)), - [dispatch] - ); - return ( { > diff --git a/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamClipSkip.tsx b/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamClipSkip.tsx index b10bab5da8..e13847d45d 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamClipSkip.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Advanced/ParamClipSkip.tsx @@ -24,10 +24,6 @@ const ParamClipSkip = () => { [dispatch] ); - const handleClipSkipReset = useCallback(() => { - dispatch(setClipSkip(0)); - }, [dispatch]); - const max = useMemo(() => { if (!model) { return CLIP_SKIP_MAP['sd-1'].maxClip; @@ -50,11 +46,11 @@ const ParamClipSkip = () => { diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxHeight.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxHeight.tsx index c300490a44..2c8cf1571c 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxHeight.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxHeight.tsx @@ -41,10 +41,6 @@ const ParamBoundingBoxWidth = () => { [ctx] ); - const onReset = useCallback(() => { - ctx.heightChanged(initial); - }, [ctx, initial]); - return ( { step={CANVAS_GRID_SIZE_COARSE} fineStep={CANVAS_GRID_SIZE_FINE} value={ctx.height} + defaultValue={initial} onChange={onChange} - onReset={onReset} marks withNumberInput numberInputMax={4096} diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxWidth.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxWidth.tsx index 2f3253ad43..b7540017e7 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxWidth.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/BoundingBox/ParamBoundingBoxWidth.tsx @@ -41,10 +41,6 @@ const ParamBoundingBoxWidth = () => { [ctx] ); - const onReset = useCallback(() => { - ctx.widthChanged(initial); - }, [ctx, initial]); - return ( { step={CANVAS_GRID_SIZE_COARSE} fineStep={CANVAS_GRID_SIZE_FINE} value={ctx.width} + defaultValue={initial} onChange={onChange} - onReset={onReset} withNumberInput numberInputMax={4096} marks diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceSteps.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceSteps.tsx index 8b9c5499f2..39e4127565 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceSteps.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceSteps.tsx @@ -20,10 +20,6 @@ const ParamCanvasCoherenceSteps = () => { [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setCanvasCoherenceSteps(20)); - }, [dispatch]); - return ( { max={100} step={1} value={canvasCoherenceSteps} + defaultValue={20} onChange={handleChange} - onReset={handleReset} withNumberInput numberInputMax={999} marks diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceStrength.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceStrength.tsx index 641d93b4ea..e8ff07c3d0 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceStrength.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/CoherencePass/ParamCanvasCoherenceStrength.tsx @@ -19,9 +19,6 @@ const ParamCanvasCoherenceStrength = () => { }, [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setCanvasCoherenceStrength(0.3)); - }, [dispatch]); return ( { max={1} step={0.01} value={canvasCoherenceStrength} + defaultValue={0.75} onChange={handleChange} - onReset={handleReset} withNumberInput numberInputMax={999} marks diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/MaskAdjustment/ParamMaskBlur.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/MaskAdjustment/ParamMaskBlur.tsx index 7a4221bbc2..8e7b244183 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/MaskAdjustment/ParamMaskBlur.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/Compositing/MaskAdjustment/ParamMaskBlur.tsx @@ -19,9 +19,6 @@ const ParamMaskBlur = () => { }, [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setMaskBlur(16)); - }, [dispatch]); return ( @@ -29,7 +26,7 @@ const ParamMaskBlur = () => { min={0} max={64} value={maskBlur} - onReset={handleReset} + defaultValue={16} onChange={handleChange} marks withNumberInput diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillPatchmatchDownscaleSize.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillPatchmatchDownscaleSize.tsx index 0b5225201a..fe63edb3bf 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillPatchmatchDownscaleSize.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillPatchmatchDownscaleSize.tsx @@ -30,10 +30,6 @@ const ParamInfillPatchmatchDownscaleSize = () => { [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setInfillPatchmatchDownscaleSize(2)); - }, [dispatch]); - return ( { min={1} max={10} value={infillPatchmatchDownscaleSize} + defaultValue={1} onChange={handleChange} withNumberInput marks - onReset={handleReset} /> ); diff --git a/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillTilesize.tsx b/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillTilesize.tsx index c99117500a..db9f13949d 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillTilesize.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Canvas/InfillAndScaling/ParamInfillTilesize.tsx @@ -29,10 +29,6 @@ const ParamInfillTileSize = () => { [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setInfillTileSize(32)); - }, [dispatch]); - return ( { max={64} numberInputMax={256} value={infillTileSize} + defaultValue={32} onChange={handleChange} withNumberInput marks - onReset={handleReset} /> ); diff --git a/invokeai/frontend/web/src/features/parameters/components/Core/ParamCFGScale.tsx b/invokeai/frontend/web/src/features/parameters/components/Core/ParamCFGScale.tsx index d720c32bc8..f10438cddb 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Core/ParamCFGScale.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Core/ParamCFGScale.tsx @@ -46,20 +46,16 @@ const ParamCFGScale = () => { [dispatch] ); - const onReset = useCallback(() => { - dispatch(setCfgScale(initial)); - }, [dispatch, initial]); - return ( { [ctx] ); - const onReset = useCallback(() => { - ctx.heightChanged(initial); - }, [ctx, initial]); - const marks = useMemo(() => [min, initial, max], [min, initial, max]); return ( { max={inputMax} step={step} fineStep={fineStep} + defaultValue={initial} /> ); diff --git a/invokeai/frontend/web/src/features/parameters/components/Core/ParamSteps.tsx b/invokeai/frontend/web/src/features/parameters/components/Core/ParamSteps.tsx index 55c185a883..e81f851399 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Core/ParamSteps.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Core/ParamSteps.tsx @@ -43,10 +43,6 @@ const ParamSteps = () => { [dispatch] ); - const onReset = useCallback(() => { - dispatch(setSteps(initial)); - }, [dispatch, initial]); - const onBlur = useCallback(() => { dispatch(clampSymmetrySteps()); }, [dispatch]); @@ -55,12 +51,12 @@ const ParamSteps = () => { { [ctx] ); - const onReset = useCallback(() => { - ctx.widthChanged(initial); - }, [ctx, initial]); - const marks = useMemo(() => [min, initial, max], [min, initial, max]); return ( @@ -54,7 +50,7 @@ export const ParamWidth = memo(() => { { max={inputMax} step={step} fineStep={fineStep} + defaultValue={initial} /> ); diff --git a/invokeai/frontend/web/src/features/parameters/components/ImageToImage/ImageToImageStrength.tsx b/invokeai/frontend/web/src/features/parameters/components/ImageToImage/ImageToImageStrength.tsx index 2baa72533a..cee276b2b0 100644 --- a/invokeai/frontend/web/src/features/parameters/components/ImageToImage/ImageToImageStrength.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/ImageToImage/ImageToImageStrength.tsx @@ -39,10 +39,6 @@ const ImageToImageStrength = () => { [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setImg2imgStrength(initial)); - }, [dispatch, initial]); - return ( { min={min} max={sliderMax} onChange={handleChange} - onReset={handleReset} value={img2imgStrength} + defaultValue={initial} marks={marks} withNumberInput numberInputMax={inputMax} diff --git a/invokeai/frontend/web/src/features/parameters/components/Seed/ParamSeedNumberInput.tsx b/invokeai/frontend/web/src/features/parameters/components/Seed/ParamSeedNumberInput.tsx index b52408c0f7..8aeefd3907 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Seed/ParamSeedNumberInput.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Seed/ParamSeedNumberInput.tsx @@ -31,6 +31,7 @@ export const ParamSeedNumberInput = memo(() => { onChange={handleChangeSeed} value={seed} flexGrow={1} + defaultValue={0} /> ); diff --git a/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryHorizontal.tsx b/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryHorizontal.tsx index fe749d1649..2c9f39df36 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryHorizontal.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryHorizontal.tsx @@ -23,21 +23,18 @@ const ParamSymmetryHorizontal = () => { }, [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setHorizontalSymmetrySteps(0)); - }, [dispatch]); return ( ); diff --git a/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryVertical.tsx b/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryVertical.tsx index 55eca6d1f3..6956e947f6 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryVertical.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Symmetry/ParamSymmetryVertical.tsx @@ -23,21 +23,18 @@ const ParamSymmetryVertical = () => { }, [dispatch] ); - const handleReset = useCallback(() => { - dispatch(setVerticalSymmetrySteps(0)); - }, [dispatch]); return ( ); diff --git a/invokeai/frontend/web/src/features/queue/components/InvokeQueueBackButton.tsx b/invokeai/frontend/web/src/features/queue/components/InvokeQueueBackButton.tsx index d156e63977..a8b56c91ad 100644 --- a/invokeai/frontend/web/src/features/queue/components/InvokeQueueBackButton.tsx +++ b/invokeai/frontend/web/src/features/queue/components/InvokeQueueBackButton.tsx @@ -64,6 +64,7 @@ export const InvokeQueueBackButton = memo(() => { max={999} onChange={handleChange} value={iterations} + defaultValue={1} numberInputFieldProps={numberInputFieldProps} pos="absolute" insetInlineEnd={0} diff --git a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerCFGScale.tsx b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerCFGScale.tsx index 6dcb12e47a..6d7694b56c 100644 --- a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerCFGScale.tsx +++ b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerCFGScale.tsx @@ -34,20 +34,16 @@ const ParamSDXLRefinerCFGScale = () => { [dispatch] ); - const onReset = useCallback(() => { - dispatch(setRefinerCFGScale(initial)); - }, [dispatch, initial]); - return ( { [dispatch] ); - const handleReset = useCallback( - () => dispatch(setRefinerNegativeAestheticScore(2.5)), - [dispatch] - ); - return ( { step={0.5} fineStep={0.1} onChange={handleChange} - onReset={handleReset} value={refinerNegativeAestheticScore} + defaultValue={2.5} withNumberInput marks /> diff --git a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerPositiveAestheticScore.tsx b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerPositiveAestheticScore.tsx index 2ae9b8d1f1..9225003074 100644 --- a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerPositiveAestheticScore.tsx +++ b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerPositiveAestheticScore.tsx @@ -17,11 +17,6 @@ const ParamSDXLRefinerPositiveAestheticScore = () => { [dispatch] ); - const handleReset = useCallback( - () => dispatch(setRefinerPositiveAestheticScore(6)), - [dispatch] - ); - return ( { max={10} fineStep={0.1} onChange={handleChange} - onReset={handleReset} value={refinerPositiveAestheticScore} + defaultValue={6} withNumberInput marks /> diff --git a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerStart.tsx b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerStart.tsx index 3fbab96466..da5487b831 100644 --- a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerStart.tsx +++ b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerStart.tsx @@ -23,11 +23,6 @@ const ParamSDXLRefinerStart = () => { ); const { t } = useTranslation(); - const handleReset = useCallback( - () => dispatch(setRefinerStart(0.8)), - [dispatch] - ); - return ( { min={0} max={1} onChange={handleChange} - onReset={handleReset} + defaultValue={0.8} value={refinerStart} withNumberInput marks diff --git a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerSteps.tsx b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerSteps.tsx index 218ae99560..0819c39862 100644 --- a/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerSteps.tsx +++ b/invokeai/frontend/web/src/features/sdxl/components/SDXLRefiner/ParamSDXLRefinerSteps.tsx @@ -35,20 +35,16 @@ const ParamSDXLRefinerSteps = () => { [dispatch] ); - const onReset = useCallback(() => { - dispatch(setRefinerSteps(initial)); - }, [dispatch, initial]); - return (