mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Add Swap Sizes
This commit is contained in:
parent
3476c58702
commit
964c71dcb0
@ -529,7 +529,7 @@
|
|||||||
"showPreview": "Show Preview",
|
"showPreview": "Show Preview",
|
||||||
"controlNetControlMode": "Control Mode",
|
"controlNetControlMode": "Control Mode",
|
||||||
"clipSkip": "Clip Skip",
|
"clipSkip": "Clip Skip",
|
||||||
"aspectRatio": "Aspect Ratio"
|
"aspectRatio": "Ratio"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"models": "Models",
|
"models": "Models",
|
||||||
@ -672,6 +672,7 @@
|
|||||||
},
|
},
|
||||||
"ui": {
|
"ui": {
|
||||||
"showProgressImages": "Show Progress Images",
|
"showProgressImages": "Show Progress Images",
|
||||||
"hideProgressImages": "Hide Progress Images"
|
"hideProgressImages": "Hide Progress Images",
|
||||||
|
"swapSizes": "Swap Sizes"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ import { setAspectRatio } from 'features/ui/store/uiSlice';
|
|||||||
|
|
||||||
const aspectRatios = [
|
const aspectRatios = [
|
||||||
{ name: 'Free', value: null },
|
{ name: 'Free', value: null },
|
||||||
{ name: '4:3', value: 4 / 3 },
|
{ name: 'Portrait', value: 0.67 / 1 },
|
||||||
{ name: '16:9', value: 16 / 9 },
|
{ name: 'Wide', value: 16 / 9 },
|
||||||
{ name: '3:2', value: 3 / 2 },
|
{ name: 'Square', value: 1 / 1 },
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function ParamAspectRatio() {
|
export default function ParamAspectRatio() {
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
import { Flex, Spacer, Text } from '@chakra-ui/react';
|
import { Flex, Spacer, Text } from '@chakra-ui/react';
|
||||||
import { RootState } from 'app/store/store';
|
import { RootState } from 'app/store/store';
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
|
import { toggleSize } from 'features/parameters/store/generationSlice';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { MdOutlineSwapVert } from 'react-icons/md';
|
||||||
import ParamAspectRatio from './ParamAspectRatio';
|
import ParamAspectRatio from './ParamAspectRatio';
|
||||||
import ParamHeight from './ParamHeight';
|
import ParamHeight from './ParamHeight';
|
||||||
import ParamWidth from './ParamWidth';
|
import ParamWidth from './ParamWidth';
|
||||||
|
|
||||||
export default function ParamSize() {
|
export default function ParamSize() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
const shouldFitToWidthHeight = useAppSelector(
|
const shouldFitToWidthHeight = useAppSelector(
|
||||||
(state: RootState) => state.generation.shouldFitToWidthHeight
|
(state: RootState) => state.generation.shouldFitToWidthHeight
|
||||||
);
|
);
|
||||||
@ -40,11 +44,21 @@ export default function ParamSize() {
|
|||||||
</Text>
|
</Text>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<ParamAspectRatio />
|
<ParamAspectRatio />
|
||||||
|
<IAIIconButton
|
||||||
|
tooltip={t('ui.swapSizes')}
|
||||||
|
aria-label={t('ui.swapSizes')}
|
||||||
|
size="sm"
|
||||||
|
icon={<MdOutlineSwapVert />}
|
||||||
|
fontSize={20}
|
||||||
|
onClick={() => dispatch(toggleSize())}
|
||||||
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap={2} flexDirection="column">
|
<Flex gap={2} alignItems="center">
|
||||||
|
<Flex gap={2} flexDirection="column" width="full">
|
||||||
<ParamWidth isDisabled={!shouldFitToWidthHeight} />
|
<ParamWidth isDisabled={!shouldFitToWidthHeight} />
|
||||||
<ParamHeight isDisabled={!shouldFitToWidthHeight} />
|
<ParamHeight isDisabled={!shouldFitToWidthHeight} />
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,11 @@ export const generationSlice = createSlice({
|
|||||||
setWidth: (state, action: PayloadAction<number>) => {
|
setWidth: (state, action: PayloadAction<number>) => {
|
||||||
state.width = action.payload;
|
state.width = action.payload;
|
||||||
},
|
},
|
||||||
|
toggleSize: (state) => {
|
||||||
|
const [width, height] = [state.width, state.height];
|
||||||
|
state.width = height;
|
||||||
|
state.height = width;
|
||||||
|
},
|
||||||
setScheduler: (state, action: PayloadAction<SchedulerParam>) => {
|
setScheduler: (state, action: PayloadAction<SchedulerParam>) => {
|
||||||
state.scheduler = action.payload;
|
state.scheduler = action.payload;
|
||||||
},
|
},
|
||||||
@ -281,7 +286,9 @@ export const {
|
|||||||
resetParametersState,
|
resetParametersState,
|
||||||
resetSeed,
|
resetSeed,
|
||||||
setCfgScale,
|
setCfgScale,
|
||||||
|
setWidth,
|
||||||
setHeight,
|
setHeight,
|
||||||
|
toggleSize,
|
||||||
setImg2imgStrength,
|
setImg2imgStrength,
|
||||||
setInfillMethod,
|
setInfillMethod,
|
||||||
setIterations,
|
setIterations,
|
||||||
@ -302,7 +309,6 @@ export const {
|
|||||||
setThreshold,
|
setThreshold,
|
||||||
setTileSize,
|
setTileSize,
|
||||||
setVariationAmount,
|
setVariationAmount,
|
||||||
setWidth,
|
|
||||||
setShouldUseSymmetry,
|
setShouldUseSymmetry,
|
||||||
setHorizontalSymmetrySteps,
|
setHorizontalSymmetrySteps,
|
||||||
setVerticalSymmetrySteps,
|
setVerticalSymmetrySteps,
|
||||||
|
Loading…
Reference in New Issue
Block a user