mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add number input to scale slider
This commit is contained in:
parent
ffa39d74b3
commit
c3a8184431
@ -1,12 +1,12 @@
|
|||||||
import { CompositeSlider, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import { scaleChanged } from 'features/parameters/store/upscaleSlice';
|
import { scaleChanged } from 'features/parameters/store/upscaleSlice';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const marks = [2, 4, 8, 16];
|
const marks = [2, 4, 8];
|
||||||
|
|
||||||
const formatValue = (val: number) => `${val}x`;
|
const formatValue = (val: string | number) => `${val}x`;
|
||||||
|
|
||||||
export const UpscaleScaleSlider = memo(() => {
|
export const UpscaleScaleSlider = memo(() => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@ -23,15 +23,26 @@ export const UpscaleScaleSlider = memo(() => {
|
|||||||
return (
|
return (
|
||||||
<FormControl orientation="vertical" gap={0}>
|
<FormControl orientation="vertical" gap={0}>
|
||||||
<FormLabel m={0}>{t('upscaling.scale')}</FormLabel>
|
<FormLabel m={0}>{t('upscaling.scale')}</FormLabel>
|
||||||
|
<Flex w="full" gap={4}>
|
||||||
<CompositeSlider
|
<CompositeSlider
|
||||||
min={2}
|
min={2}
|
||||||
max={16}
|
max={8}
|
||||||
value={scale}
|
value={scale}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
marks={marks}
|
marks={marks}
|
||||||
formatValue={formatValue}
|
formatValue={formatValue}
|
||||||
withThumbTooltip
|
defaultValue={4}
|
||||||
/>
|
/>
|
||||||
|
<CompositeNumberInput
|
||||||
|
maxW={20}
|
||||||
|
value={scale}
|
||||||
|
onChange={onChange}
|
||||||
|
defaultValue={4}
|
||||||
|
min={2}
|
||||||
|
max={16}
|
||||||
|
format={formatValue}
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user