Moves Loopback to app settings

This commit is contained in:
psychedelicious 2022-11-21 19:13:46 +11:00 committed by blessedcoolant
parent b0810e1ed7
commit 306ed44e19
3 changed files with 22 additions and 10 deletions

View File

@ -1,6 +1,5 @@
import InvokeButton from './InvokeButton'; import InvokeButton from './InvokeButton';
import CancelButton from './CancelButton'; import CancelButton from './CancelButton';
import LoopbackButton from './Loopback';
/** /**
* Buttons to start and cancel image generation. * Buttons to start and cancel image generation.
@ -9,7 +8,6 @@ const ProcessButtons = () => {
return ( return (
<div className="process-buttons"> <div className="process-buttons">
<InvokeButton /> <InvokeButton />
<LoopbackButton />
<CancelButton /> <CancelButton />
</div> </div>
); );

View File

@ -32,10 +32,13 @@ import IAISwitch from 'common/components/IAISwitch';
import IAISelect from 'common/components/IAISelect'; import IAISelect from 'common/components/IAISelect';
import IAINumberInput from 'common/components/IAINumberInput'; import IAINumberInput from 'common/components/IAINumberInput';
import EmptyTempFolderButtonModal from '../ClearTempFolderButtonModal'; import EmptyTempFolderButtonModal from '../ClearTempFolderButtonModal';
import { systemSelector } from 'features/system/store/systemSelectors';
import { optionsSelector } from 'features/options/store/optionsSelectors';
import { setShouldLoopback } from 'features/options/store/optionsSlice';
const systemSelector = createSelector( const selector = createSelector(
(state: RootState) => state.system, [systemSelector, optionsSelector],
(system: SystemState) => { (system, options) => {
const { const {
shouldDisplayInProgressType, shouldDisplayInProgressType,
shouldConfirmOnDelete, shouldConfirmOnDelete,
@ -44,6 +47,9 @@ const systemSelector = createSelector(
saveIntermediatesInterval, saveIntermediatesInterval,
enableImageDebugging, enableImageDebugging,
} = system; } = system;
const { shouldLoopback } = options;
return { return {
shouldDisplayInProgressType, shouldDisplayInProgressType,
shouldConfirmOnDelete, shouldConfirmOnDelete,
@ -51,6 +57,7 @@ const systemSelector = createSelector(
models: _.map(model_list, (_model, key) => key), models: _.map(model_list, (_model, key) => key),
saveIntermediatesInterval, saveIntermediatesInterval,
enableImageDebugging, enableImageDebugging,
shouldLoopback,
}; };
}, },
{ {
@ -92,7 +99,8 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
shouldDisplayGuides, shouldDisplayGuides,
saveIntermediatesInterval, saveIntermediatesInterval,
enableImageDebugging, enableImageDebugging,
} = useAppSelector(systemSelector); shouldLoopback,
} = useAppSelector(selector);
/** /**
* Resets localstorage, then opens a secondary modal informing user to * Resets localstorage, then opens a secondary modal informing user to
@ -172,6 +180,14 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
dispatch(setShouldDisplayGuides(e.target.checked)) dispatch(setShouldDisplayGuides(e.target.checked))
} }
/> />
<IAISwitch
styleClass="settings-modal-item"
label={'Image to Image Loopback'}
isChecked={shouldLoopback}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldLoopback(e.target.checked))
}
/>
</div> </div>
<div className="settings-modal-items"> <div className="settings-modal-items">

View File

@ -1,5 +1,4 @@
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { IoMdOptions } from 'react-icons/io';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState, useAppDispatch, useAppSelector } from 'app/store';
import IAIIconButton from 'common/components/IAIIconButton'; import IAIIconButton from 'common/components/IAIIconButton';
import { import {
@ -9,8 +8,8 @@ import {
import CancelButton from 'features/options/components/ProcessButtons/CancelButton'; import CancelButton from 'features/options/components/ProcessButtons/CancelButton';
import InvokeButton from 'features/options/components/ProcessButtons/InvokeButton'; import InvokeButton from 'features/options/components/ProcessButtons/InvokeButton';
import _ from 'lodash'; import _ from 'lodash';
import LoopbackButton from 'features/options/components/ProcessButtons/Loopback';
import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice';
import { FaSlidersH } from 'react-icons/fa';
const canInvokeSelector = createSelector( const canInvokeSelector = createSelector(
(state: RootState) => state.options, (state: RootState) => state.options,
@ -46,12 +45,11 @@ const FloatingOptionsPanelButtons = () => {
aria-label="Show Options Panel" aria-label="Show Options Panel"
onClick={handleShowOptionsPanel} onClick={handleShowOptionsPanel}
> >
<IoMdOptions /> <FaSlidersH />
</IAIIconButton> </IAIIconButton>
{shouldShowProcessButtons && ( {shouldShowProcessButtons && (
<> <>
<InvokeButton iconButton /> <InvokeButton iconButton />
<LoopbackButton />
<CancelButton /> <CancelButton />
</> </>
)} )}