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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): step workflow float fields by tenths
Josh Corbetta93873842ff7
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsxindex ab9562295c..0eefee1dc5 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx@@ -64,6 +64,9 @@ export interface NumericInputProps {value: unknown;}+// Tenths, as in v6; a template's `multipleOf` or the host's `step` takes precedence.+const FLOAT_STEP = '0.1';+/** A double-click anywhere in the box selects the whole value, not just the word under the pointer. */const selectInputText = (event: MouseEvent<HTMLInputElement>) => event.currentTarget.select();@@ -159,7 +162,9 @@ export const NumericInput = ({min={min !== undefined ? String(min) : undefined}fontVariantNumeric="tabular-nums"size={size}- step={multipleOf !== undefined ? String(multipleOf) : step !== undefined ? String(step) : isInteger ? '1' : 'any'}+ step={+ multipleOf !== undefined ? String(multipleOf) : step !== undefined ? String(step) : isInteger ? '1' : FLOAT_STEP+ }type="number"value={text}w="full"diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsxindex 0b017593a4..247b5a329a 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.browser.test.tsx@@ -1675,6 +1675,16 @@ describe('WorkflowFieldInput text and number entry', () => {await keys('{ArrowUp}');expect(integer.input.value).toBe('4');expect(integer.onCommit).toHaveBeenLastCalledWith(4);++ // A float without a declared step moves by tenths, and a typed value off that step stays valid.+ const float = await renderStateful(FLOAT, 0.5);++ await keys('{ArrowUp}');+ expect(float.input.value).toBe('0.6');+ expect(float.onCommit).toHaveBeenLastCalledWith(0.6);+ await keys('{Control>}a{/Control}0.15');+ expect(float.onCommit).toHaveBeenLastCalledWith(0.15);+ expect(isInvalid(float.input)).toBe(false);});it('pastes a number at the caret and over a selection', async () => {