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

@ -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