Skip to content

Commit 6733f5b

Browse files
always enable these things on txt2img tab (#3726)
2 parents e06a6bb + 913789d commit 6733f5b

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamAspectRatio.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RootState } from 'app/store/store';
33
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
44
import IAIButton from 'common/components/IAIButton';
55
import { setAspectRatio } from 'features/ui/store/uiSlice';
6+
import { activeTabNameSelector } from '../../../../ui/store/uiSelectors';
67

78
const aspectRatios = [
89
{ name: 'Free', value: null },
@@ -17,6 +18,10 @@ export default function ParamAspectRatio() {
1718
);
1819

1920
const dispatch = useAppDispatch();
21+
const shouldFitToWidthHeight = useAppSelector(
22+
(state: RootState) => state.generation.shouldFitToWidthHeight
23+
);
24+
const activeTabName = useAppSelector(activeTabNameSelector);
2025

2126
return (
2227
<Flex gap={2} flexGrow={1}>
@@ -26,6 +31,9 @@ export default function ParamAspectRatio() {
2631
key={ratio.name}
2732
size="sm"
2833
isChecked={aspectRatio === ratio.value}
34+
isDisabled={
35+
activeTabName === 'img2img' ? !shouldFitToWidthHeight : false
36+
}
2937
onClick={() => dispatch(setAspectRatio(ratio.value))}
3038
>
3139
{ratio.name}

invokeai/frontend/web/src/features/parameters/components/Parameters/Core/ParamSize.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import { MdOutlineSwapVert } from 'react-icons/md';
88
import ParamAspectRatio from './ParamAspectRatio';
99
import ParamHeight from './ParamHeight';
1010
import ParamWidth from './ParamWidth';
11+
import { activeTabNameSelector } from '../../../../ui/store/uiSelectors';
1112

1213
export default function ParamSize() {
1314
const { t } = useTranslation();
1415
const dispatch = useAppDispatch();
1516
const shouldFitToWidthHeight = useAppSelector(
1617
(state: RootState) => state.generation.shouldFitToWidthHeight
1718
);
19+
const activeTabName = useAppSelector(activeTabNameSelector);
1820
return (
1921
<Flex
2022
sx={{
@@ -50,13 +52,24 @@ export default function ParamSize() {
5052
size="sm"
5153
icon={<MdOutlineSwapVert />}
5254
fontSize={20}
55+
isDisabled={
56+
activeTabName === 'img2img' ? !shouldFitToWidthHeight : false
57+
}
5358
onClick={() => dispatch(toggleSize())}
5459
/>
5560
</Flex>
5661
<Flex gap={2} alignItems="center">
5762
<Flex gap={2} flexDirection="column" width="full">
58-
<ParamWidth isDisabled={!shouldFitToWidthHeight} />
59-
<ParamHeight isDisabled={!shouldFitToWidthHeight} />
63+
<ParamWidth
64+
isDisabled={
65+
activeTabName === 'img2img' ? !shouldFitToWidthHeight : false
66+
}
67+
/>
68+
<ParamHeight
69+
isDisabled={
70+
activeTabName === 'img2img' ? !shouldFitToWidthHeight : false
71+
}
72+
/>
6073
</Flex>
6174
</Flex>
6275
</Flex>

0 commit comments

Comments
 (0)