fix: cyclic redundancy

This commit is contained in:
blessedcoolant 2023-08-30 09:12:07 +12:00
parent b5da7faafb
commit 1b6586dd8c
2 changed files with 2 additions and 5 deletions

View File

@ -15,8 +15,6 @@ const aspectRatios = [
{ name: '1:1', value: 1 / 1 },
];
export const mappedAspectRatios = aspectRatios.map((ar) => ar.value);
export default function ParamAspectRatio() {
const aspectRatio = useAppSelector(
(state: RootState) => state.generation.aspectRatio

View File

@ -6,7 +6,6 @@ import { clamp } from 'lodash-es';
import { ImageDTO } from 'services/api/types';
import { flipBoundingBoxAxes } from 'features/canvas/store/canvasSlice';
import { mappedAspectRatios } from '../components/Parameters/Core/ParamAspectRatio';
import { clipSkipMap } from '../types/constants';
import {
CfgScaleParam,
@ -154,7 +153,7 @@ export const generationSlice = createSlice({
},
toggleSize: (state) => {
const [width, height] = [state.width, state.height];
if (!mappedAspectRatios.includes(height / width)) {
if (![null, 2 / 3, 16 / 9, 1 / 1].includes(height / width)) {
state.aspectRatio = null;
}
state.width = height;
@ -282,7 +281,7 @@ export const generationSlice = createSlice({
setShouldLockAspectRatio: (state, action: PayloadAction<boolean>) => {
if (
action.payload === false &&
!mappedAspectRatios.includes(state.aspectRatio)
![null, 2 / 3, 16 / 9, 1 / 1].includes(state.aspectRatio)
) {
state.aspectRatio = null;
}