mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
28 lines
742 B
TypeScript
28 lines
742 B
TypeScript
import React, { ChangeEvent } from 'react';
|
|
import {
|
|
RootState,
|
|
useAppDispatch,
|
|
useAppSelector,
|
|
} from '../../../../app/store';
|
|
import IAISwitch from '../../../../common/components/IAISwitch';
|
|
import { setShouldFitToWidthHeight } from '../../optionsSlice';
|
|
|
|
export default function ImageFit() {
|
|
const dispatch = useAppDispatch();
|
|
|
|
const shouldFitToWidthHeight = useAppSelector(
|
|
(state: RootState) => state.options.shouldFitToWidthHeight
|
|
);
|
|
|
|
const handleChangeFit = (e: ChangeEvent<HTMLInputElement>) =>
|
|
dispatch(setShouldFitToWidthHeight(e.target.checked));
|
|
|
|
return (
|
|
<IAISwitch
|
|
label="Fit initial image to output size"
|
|
isChecked={shouldFitToWidthHeight}
|
|
onChange={handleChangeFit}
|
|
/>
|
|
);
|
|
}
|