diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamAspectRatio.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamAspectRatio.tsx index 0a568fb84d..e0bce7254e 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamAspectRatio.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamAspectRatio.tsx @@ -3,6 +3,7 @@ import { RootState } from 'app/store/store'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import IAIButton from 'common/components/IAIButton'; import { setAspectRatio } from 'features/ui/store/uiSlice'; +import { activeTabNameSelector } from '../../../../ui/store/uiSelectors'; const aspectRatios = [ { name: 'Free', value: null }, @@ -17,6 +18,10 @@ export default function ParamAspectRatio() { ); const dispatch = useAppDispatch(); + const shouldFitToWidthHeight = useAppSelector( + (state: RootState) => state.generation.shouldFitToWidthHeight + ); + const activeTabName = useAppSelector(activeTabNameSelector); return ( @@ -26,6 +31,9 @@ export default function ParamAspectRatio() { key={ratio.name} size="sm" isChecked={aspectRatio === ratio.value} + isDisabled={ + activeTabName === 'img2img' ? !shouldFitToWidthHeight : false + } onClick={() => dispatch(setAspectRatio(ratio.value))} > {ratio.name} diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamSize.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamSize.tsx index 496431ff3d..c629ef4601 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamSize.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamSize.tsx @@ -8,6 +8,7 @@ import { MdOutlineSwapVert } from 'react-icons/md'; import ParamAspectRatio from './ParamAspectRatio'; import ParamHeight from './ParamHeight'; import ParamWidth from './ParamWidth'; +import { activeTabNameSelector } from '../../../../ui/store/uiSelectors'; export default function ParamSize() { const { t } = useTranslation(); @@ -15,6 +16,7 @@ export default function ParamSize() { const shouldFitToWidthHeight = useAppSelector( (state: RootState) => state.generation.shouldFitToWidthHeight ); + const activeTabName = useAppSelector(activeTabNameSelector); return ( } fontSize={20} + isDisabled={ + activeTabName === 'img2img' ? !shouldFitToWidthHeight : false + } onClick={() => dispatch(toggleSize())} /> - - + +