File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
invokeai/frontend/web/src/features/parameters/components/Parameters/Core Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { RootState } from 'app/store/store';
33import { useAppDispatch , useAppSelector } from 'app/store/storeHooks' ;
44import IAIButton from 'common/components/IAIButton' ;
55import { setAspectRatio } from 'features/ui/store/uiSlice' ;
6+ import { activeTabNameSelector } from '../../../../ui/store/uiSelectors' ;
67
78const 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 }
Original file line number Diff line number Diff line change @@ -8,13 +8,15 @@ import { MdOutlineSwapVert } from 'react-icons/md';
88import ParamAspectRatio from './ParamAspectRatio' ;
99import ParamHeight from './ParamHeight' ;
1010import ParamWidth from './ParamWidth' ;
11+ import { activeTabNameSelector } from '../../../../ui/store/uiSelectors' ;
1112
1213export 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 >
You can’t perform that action at this time.
0 commit comments