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.

feat(canvas): label the brush and eraser size and opacity controls

joshistoasta1fda6a47b0f
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index 1eca317ad0..ba230b3f89 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -2271,6 +2271,7 @@
"shapeRect": "Rectangle",
"shapeStroke": "Stroke",
"shapeStrokeWidth": "Stroke width",
+ "size": "Size",
"textAlignCenter": "Align center",
"textAlignLeft": "Align left",
"textAlignRight": "Align right",
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx
index 75d129db76..fcd91ce2af 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/BrushOptions.tsx
@@ -1,6 +1,6 @@
import type { NumberInput as ChakraNumberInput, SliderValueChangeDetails } from '@chakra-ui/react';
-import { HStack, NumberInput } from '@chakra-ui/react';
+import { HStack, NumberInput, Text } from '@chakra-ui/react';
import { ColorPicker, Slider, ToggleIconButton } from '@platform/ui';
import { MAX_BRUSH_SIZE, MIN_BRUSH_SIZE } from '@workbench/canvas-engine/api';
import { useBrushOptions } from '@workbench/widgets/canvas/engineStoreHooks';
@@ -91,6 +91,9 @@ export const BrushOptions = ({ engine }: ToolOptionsComponentProps) => {
onValueChange={onColorChange}
/>
<HStack align="center" gap="1.5">
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.canvas.toolOptions.size')}
+ </Text>
<Slider
aria-label={sizeAriaLabel}
formatValue={formatSizePx}
@@ -113,16 +116,21 @@ export const BrushOptions = ({ engine }: ToolOptionsComponentProps) => {
<NumberInput.Input aria-label={t('widgets.canvas.toolOptions.brushSize')} fontSize="xs" />
</NumberInput.Root>
</HStack>
- <Slider
- aria-label={opacityAriaLabel}
- formatValue={formatOpacityPercent}
- max={100}
- min={0}
- size="sm"
- value={opacityValue}
- w="6rem"
- onValueChange={onOpacityChange}
- />
+ <HStack align="center" gap="1.5">
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.canvas.toolOptions.opacity')}
+ </Text>
+ <Slider
+ aria-label={opacityAriaLabel}
+ formatValue={formatOpacityPercent}
+ max={100}
+ min={0}
+ size="sm"
+ value={opacityValue}
+ w="6rem"
+ onValueChange={onOpacityChange}
+ />
+ </HStack>
{/*
Two independent toggles rather than one pressure switch: width and opacity are separate
pressure responses, and opacity additionally costs a full scratch refill per frame.
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx
index 757a981f0d..c48ed6c81c 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/EraserOptions.tsx
@@ -1,6 +1,6 @@
import type { NumberInput as ChakraNumberInput, SliderValueChangeDetails } from '@chakra-ui/react';
-import { HStack, NumberInput } from '@chakra-ui/react';
+import { HStack, NumberInput, Text } from '@chakra-ui/react';
import { Slider } from '@platform/ui';
import { MAX_BRUSH_SIZE, MIN_BRUSH_SIZE } from '@workbench/canvas-engine/api';
import { useEraserOptions } from '@workbench/widgets/canvas/engineStoreHooks';
@@ -63,6 +63,9 @@ export const EraserOptions = ({ engine }: ToolOptionsComponentProps) => {
return (
<HStack align="center" gap="3">
<HStack align="center" gap="1.5">
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.canvas.toolOptions.size')}
+ </Text>
<Slider
aria-label={sizeAriaLabel}
formatValue={formatSizePx}
@@ -85,16 +88,21 @@ export const EraserOptions = ({ engine }: ToolOptionsComponentProps) => {
<NumberInput.Input aria-label={t('widgets.canvas.toolOptions.eraserSize')} fontSize="xs" />
</NumberInput.Root>
</HStack>
- <Slider
- aria-label={opacityAriaLabel}
- formatValue={formatOpacityPercent}
- max={100}
- min={0}
- size="sm"
- value={opacityValue}
- w="6rem"
- onValueChange={onOpacityChange}
- />
+ <HStack align="center" gap="1.5">
+ <Text color="fg.muted" fontSize="2xs">
+ {t('widgets.canvas.toolOptions.opacity')}
+ </Text>
+ <Slider
+ aria-label={opacityAriaLabel}
+ formatValue={formatOpacityPercent}
+ max={100}
+ min={0}
+ size="sm"
+ value={opacityValue}
+ w="6rem"
+ onValueChange={onOpacityChange}
+ />
+ </HStack>
</HStack>
);
};