mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-07 23:44:57 -05:00
25 lines
761 B
TypeScript
25 lines
761 B
TypeScript
import React, { ChangeEvent } from 'react';
|
|
import { RootState } from 'app/store';
|
|
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
|
|
import IAISwitch from 'common/components/IAISwitch';
|
|
import { setShouldFitToWidthHeight } from 'features/options/store/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}
|
|
/>
|
|
);
|
|
}
|