mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): update most other selectors
Just a few stragglers left. Good enough for now.
This commit is contained in:
@ -1,39 +1,21 @@
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InvControl } from 'common/components/InvControl/InvControl';
|
||||
import { InvSlider } from 'common/components/InvSlider/InvSlider';
|
||||
import { selectHrfSlice, setHrfStrength } from 'features/hrf/store/hrfSlice';
|
||||
import { selectConfigSlice } from 'features/system/store/configSlice';
|
||||
import { setHrfStrength } from 'features/hrf/store/hrfSlice';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const selector = createMemoizedSelector(
|
||||
selectHrfSlice,
|
||||
selectConfigSlice,
|
||||
(hrf, config) => {
|
||||
const { initial, min, sliderMax, inputMax, fineStep, coarseStep } =
|
||||
config.sd.hrfStrength;
|
||||
const { hrfStrength } = hrf;
|
||||
|
||||
return {
|
||||
hrfStrength,
|
||||
initial,
|
||||
min,
|
||||
sliderMax,
|
||||
inputMax,
|
||||
step: coarseStep,
|
||||
fineStep,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const ParamHrfStrength = () => {
|
||||
const { hrfStrength, initial, min, sliderMax, step, fineStep } =
|
||||
useAppSelector(selector);
|
||||
const hrfStrength = useAppSelector((s) => s.hrf.hrfStrength);
|
||||
const initial = useAppSelector((s) => s.config.sd.hrfStrength.initial);
|
||||
const min = useAppSelector((s) => s.config.sd.hrfStrength.min);
|
||||
const sliderMax = useAppSelector((s) => s.config.sd.hrfStrength.sliderMax);
|
||||
const coarseStep = useAppSelector((s) => s.config.sd.hrfStrength.coarseStep);
|
||||
const fineStep = useAppSelector((s) => s.config.sd.hrfStrength.fineStep);
|
||||
const dispatch = useAppDispatch();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleHrfStrengthChange = useCallback(
|
||||
const onChange = useCallback(
|
||||
(v: number) => {
|
||||
dispatch(setHrfStrength(v));
|
||||
},
|
||||
@ -45,11 +27,11 @@ const ParamHrfStrength = () => {
|
||||
<InvSlider
|
||||
min={min}
|
||||
max={sliderMax}
|
||||
step={step}
|
||||
step={coarseStep}
|
||||
fineStep={fineStep}
|
||||
value={hrfStrength}
|
||||
defaultValue={initial}
|
||||
onChange={handleHrfStrengthChange}
|
||||
onChange={onChange}
|
||||
marks
|
||||
withNumberInput
|
||||
/>
|
||||
|
Reference in New Issue
Block a user