Skip to content

AI-native design editor. Open-source Figma alternative.

fix(keyboard): treat single 0 as 100% opacity

sadkodevb5de9806322c
diff --git a/src/app/shell/keyboard/actions.ts b/src/app/shell/keyboard/actions.ts
index 54af17101..2d8823afa 100644
--- a/src/app/shell/keyboard/actions.ts
+++ b/src/app/shell/keyboard/actions.ts
@@ -108,7 +108,10 @@ export function createKeyboardActions({
opacityBuffer += digit
if (opacityBuffer.length > 3) opacityBuffer = opacityBuffer.slice(-3)
const n = Number.parseInt(opacityBuffer, 10)
- const percent = opacityBuffer.length === 1 ? n * 10 : n
+ let percent: number
+ if (opacityBuffer === '0') percent = 100
+ else if (opacityBuffer.length === 1) percent = n * 10
+ else percent = n
const clamped = Math.min(100, Math.max(0, percent))
setOpacityTarget(clamped / 100)
runCommand('selection.setOpacity')