Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(webv2): shrink slider thumbs for fine pointers and align marks

joshistoast12e7ec74791f
diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx
index 5c542c208c..5b0af0d2b7 100644
--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx
@@ -301,6 +301,7 @@ const NumericSliderField = ({
marks={marks}
max={sliderMax}
min={sliderMin}
+ size="sm"
step={step}
value={[Math.min(sliderMax, Math.max(sliderMin, value))]}
onValueChange={(details) => {
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
index c0fefc3ea3..b171a9eb02 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
@@ -496,6 +496,39 @@ export const sliderSlotRecipe = defineSlotRecipe({
lineHeight: '1',
},
},
+ variants: {
+ ...chakraSlotRecipes.slider.variants,
+ size: {
+ // Chakra's thumb sizes are touch targets. With a mouse the track itself
+ // is the drag target, so fine-pointer devices get a much smaller thumb.
+ // `--slider-marker-center` must shrink with it: it is the marker group's
+ // top offset, (thumb - marker) / 2, keeping marks centered on the track.
+ // `--slider-marker-inset` is zeroed at every size: zag already offsets
+ // marks by half the thumb within the group, so any extra inset shifts
+ // the end marks off the thumb positions they label.
+ lg: {
+ root: {
+ ...chakraSlotRecipes.slider.variants?.size?.lg?.root,
+ '--slider-marker-inset': '0px',
+ '@media (pointer: fine)': { '--slider-marker-center': '4px', '--slider-thumb-size': 'sizes.3.5' },
+ },
+ },
+ md: {
+ root: {
+ ...chakraSlotRecipes.slider.variants?.size?.md?.root,
+ '--slider-marker-inset': '0px',
+ '@media (pointer: fine)': { '--slider-marker-center': '4px', '--slider-thumb-size': 'sizes.3' },
+ },
+ },
+ sm: {
+ root: {
+ ...chakraSlotRecipes.slider.variants?.size?.sm?.root,
+ '--slider-marker-inset': '0px',
+ '@media (pointer: fine)': { '--slider-marker-center': '3px', '--slider-thumb-size': 'sizes.2.5' },
+ },
+ },
+ },
+ } as unknown as typeof chakraSlotRecipes.slider.variants,
});
export const progressCircleSlotRecipe = defineSlotRecipe({