fix(ui): remove w/h from canvas params, add bbox w/h

This commit is contained in:
psychedelicious 2023-05-30 16:55:10 +10:00 committed by Kent Keirsey
parent 1a3fd05b81
commit cffcf80977
5 changed files with 28 additions and 18 deletions

View File

@ -454,6 +454,8 @@
"height": "Height",
"scheduler": "Scheduler",
"seed": "Seed",
"boundingBoxWidth": "Bounding Box Width",
"boundingBoxHeight": "Bounding Box Height",
"imageToImage": "Image to Image",
"randomizeSeed": "Randomize Seed",
"shuffle": "Shuffle Seed",

View File

@ -2,18 +2,22 @@ import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAISlider from 'common/components/IAISlider';
import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import {
canvasSelector,
isStagingSelector,
} from 'features/canvas/store/canvasSelectors';
import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const selector = createSelector(
canvasSelector,
(canvas) => {
[canvasSelector, isStagingSelector],
(canvas, isStaging) => {
const { boundingBoxDimensions } = canvas;
return {
boundingBoxDimensions,
isStaging,
};
},
defaultSelectorOptions
@ -21,7 +25,7 @@ const selector = createSelector(
const ParamBoundingBoxWidth = () => {
const dispatch = useAppDispatch();
const { boundingBoxDimensions } = useAppSelector(selector);
const { boundingBoxDimensions, isStaging } = useAppSelector(selector);
const { t } = useTranslation();
@ -45,12 +49,13 @@ const ParamBoundingBoxWidth = () => {
return (
<IAISlider
label={t('parameters.height')}
label={t('parameters.boundingBoxHeight')}
min={64}
max={1024}
step={64}
value={boundingBoxDimensions.height}
onChange={handleChangeHeight}
isDisabled={isStaging}
sliderNumberInputProps={{ max: 4096 }}
withSliderMarks
withInput

View File

@ -2,18 +2,22 @@ import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAISlider from 'common/components/IAISlider';
import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import {
canvasSelector,
isStagingSelector,
} from 'features/canvas/store/canvasSelectors';
import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const selector = createSelector(
canvasSelector,
(canvas) => {
[canvasSelector, isStagingSelector],
(canvas, isStaging) => {
const { boundingBoxDimensions } = canvas;
return {
boundingBoxDimensions,
isStaging,
};
},
defaultSelectorOptions
@ -21,7 +25,7 @@ const selector = createSelector(
const ParamBoundingBoxWidth = () => {
const dispatch = useAppDispatch();
const { boundingBoxDimensions } = useAppSelector(selector);
const { boundingBoxDimensions, isStaging } = useAppSelector(selector);
const { t } = useTranslation();
@ -45,12 +49,13 @@ const ParamBoundingBoxWidth = () => {
return (
<IAISlider
label={t('parameters.width')}
label={t('parameters.boundingBoxWidth')}
min={64}
max={1024}
step={64}
value={boundingBoxDimensions.width}
onChange={handleChangeWidth}
isDisabled={isStaging}
sliderNumberInputProps={{ max: 4096 }}
withSliderMarks
withInput

View File

@ -7,11 +7,11 @@ import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import ParamIterations from 'features/parameters/components/Parameters/Core/ParamIterations';
import ParamSteps from 'features/parameters/components/Parameters/Core/ParamSteps';
import ParamCFGScale from 'features/parameters/components/Parameters/Core/ParamCFGScale';
import ParamWidth from 'features/parameters/components/Parameters/Core/ParamWidth';
import ParamHeight from 'features/parameters/components/Parameters/Core/ParamHeight';
import ImageToImageStrength from 'features/parameters/components/Parameters/ImageToImage/ImageToImageStrength';
import ImageToImageFit from 'features/parameters/components/Parameters/ImageToImage/ImageToImageFit';
import ParamSchedulerAndModel from 'features/parameters/components/Parameters/Core/ParamSchedulerAndModel';
import ParamBoundingBoxWidth from 'features/parameters/components/Parameters/Canvas/BoundingBox/ParamBoundingBoxWidth';
import ParamBoundingBoxHeight from 'features/parameters/components/Parameters/Canvas/BoundingBox/ParamBoundingBoxHeight';
const selector = createSelector(
uiSelector,
@ -41,8 +41,8 @@ const UnifiedCanvasCoreParameters = () => {
<ParamIterations />
<ParamSteps />
<ParamCFGScale />
<ParamWidth />
<ParamHeight />
<ParamBoundingBoxWidth />
<ParamBoundingBoxHeight />
<ImageToImageStrength />
<ImageToImageFit />
<ParamSchedulerAndModel />
@ -55,8 +55,8 @@ const UnifiedCanvasCoreParameters = () => {
<ParamCFGScale />
</Flex>
<ParamSchedulerAndModel />
<ParamWidth />
<ParamHeight />
<ParamBoundingBoxWidth />
<ParamBoundingBoxHeight />
<ImageToImageStrength />
</Flex>
)}

View File

@ -2,7 +2,6 @@ import ProcessButtons from 'features/parameters/components/ProcessButtons/Proces
import ParamSeedCollapse from 'features/parameters/components/Parameters/Seed/ParamSeedCollapse';
import ParamVariationCollapse from 'features/parameters/components/Parameters/Variations/ParamVariationCollapse';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
import ParamBoundingBoxCollapse from 'features/parameters/components/Parameters/Canvas/BoundingBox/ParamBoundingBoxCollapse';
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamSeamCorrectionCollapse from 'features/parameters/components/Parameters/Canvas/SeamCorrection/ParamSeamCorrectionCollapse';
import UnifiedCanvasCoreParameters from './UnifiedCanvasCoreParameters';
@ -20,7 +19,6 @@ const UnifiedCanvasParameters = () => {
<ParamSeedCollapse />
<ParamVariationCollapse />
<ParamSymmetryCollapse />
<ParamBoundingBoxCollapse />
<ParamSeamCorrectionCollapse />
<ParamInfillAndScalingCollapse />
</>