feat(ui): disable w/h when img2img & not fit

This commit is contained in:
psychedelicious 2023-05-01 16:55:05 +10:00
parent b49d76ebee
commit 276dfc591b
2 changed files with 45 additions and 8 deletions

View File

@ -13,17 +13,35 @@ const selector = createSelector(
(generation, hotkeys, config) => {
const { initial, min, sliderMax, inputMax, fineStep, coarseStep } =
config.sd.height;
const { height } = generation;
const { height, shouldFitToWidthHeight, isImageToImageEnabled } =
generation;
const step = hotkeys.shift ? fineStep : coarseStep;
return { height, initial, min, sliderMax, inputMax, step };
return {
height,
initial,
min,
sliderMax,
inputMax,
step,
shouldFitToWidthHeight,
isImageToImageEnabled,
};
}
);
const HeightSlider = () => {
const { height, initial, min, sliderMax, inputMax, step } =
useAppSelector(selector);
const {
height,
initial,
min,
sliderMax,
inputMax,
step,
shouldFitToWidthHeight,
isImageToImageEnabled,
} = useAppSelector(selector);
const dispatch = useAppDispatch();
const { t } = useTranslation();
@ -40,6 +58,7 @@ const HeightSlider = () => {
return (
<IAISlider
isDisabled={!shouldFitToWidthHeight && isImageToImageEnabled}
label={t('parameters.height')}
value={height}
min={min}

View File

@ -13,17 +13,34 @@ const selector = createSelector(
(generation, hotkeys, config) => {
const { initial, min, sliderMax, inputMax, fineStep, coarseStep } =
config.sd.width;
const { width } = generation;
const { width, shouldFitToWidthHeight, isImageToImageEnabled } = generation;
const step = hotkeys.shift ? fineStep : coarseStep;
return { width, initial, min, sliderMax, inputMax, step };
return {
width,
initial,
min,
sliderMax,
inputMax,
step,
shouldFitToWidthHeight,
isImageToImageEnabled,
};
}
);
const WidthSlider = () => {
const { width, initial, min, sliderMax, inputMax, step } =
useAppSelector(selector);
const {
width,
initial,
min,
sliderMax,
inputMax,
step,
shouldFitToWidthHeight,
isImageToImageEnabled,
} = useAppSelector(selector);
const dispatch = useAppDispatch();
const { t } = useTranslation();
@ -40,6 +57,7 @@ const WidthSlider = () => {
return (
<IAISlider
isDisabled={!shouldFitToWidthHeight && isImageToImageEnabled}
label={t('parameters.width')}
value={width}
min={min}