Skip to content

Commit c3a8184

Browse files
feat(ui): add number input to scale slider
1 parent ffa39d7 commit c3a8184

File tree

1 file changed

+23
-12
lines changed
  • invokeai/frontend/web/src/features/settingsAccordions/components/UpscaleSettingsAccordion

1 file changed

+23
-12
lines changed

invokeai/frontend/web/src/features/settingsAccordions/components/UpscaleSettingsAccordion/UpscaleScaleSlider.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { CompositeSlider, FormControl, FormLabel } from '@invoke-ai/ui-library';
1+
import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library';
22
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
33
import { scaleChanged } from 'features/parameters/store/upscaleSlice';
44
import { memo, useCallback } from 'react';
55
import { useTranslation } from 'react-i18next';
66

7-
const marks = [2, 4, 8, 16];
7+
const marks = [2, 4, 8];
88

9-
const formatValue = (val: number) => `${val}x`;
9+
const formatValue = (val: string | number) => `${val}x`;
1010

1111
export const UpscaleScaleSlider = memo(() => {
1212
const dispatch = useAppDispatch();
@@ -23,15 +23,26 @@ export const UpscaleScaleSlider = memo(() => {
2323
return (
2424
<FormControl orientation="vertical" gap={0}>
2525
<FormLabel m={0}>{t('upscaling.scale')}</FormLabel>
26-
<CompositeSlider
27-
min={2}
28-
max={16}
29-
value={scale}
30-
onChange={onChange}
31-
marks={marks}
32-
formatValue={formatValue}
33-
withThumbTooltip
34-
/>
26+
<Flex w="full" gap={4}>
27+
<CompositeSlider
28+
min={2}
29+
max={8}
30+
value={scale}
31+
onChange={onChange}
32+
marks={marks}
33+
formatValue={formatValue}
34+
defaultValue={4}
35+
/>
36+
<CompositeNumberInput
37+
maxW={20}
38+
value={scale}
39+
onChange={onChange}
40+
defaultValue={4}
41+
min={2}
42+
max={16}
43+
format={formatValue}
44+
/>
45+
</Flex>
3546
</FormControl>
3647
);
3748
});

0 commit comments

Comments
 (0)