8000 fix(fx): make envelope screen usable on mobile by johannboehme · Pull Request #10 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

fix(fx): make envelope screen usable on mobile - #10

Merged
johannboehme merged 1 commit into
mainfrom
claude/mystifying-montalcini-849318
May 2, 2026
Merged

johannboehme merged 1 commit into
mainfrom
claude/mystifying-montalcini-849318

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Summary

The ADSR envelope editor in the FX panel was unusable on mobile — the LCD collapsed to a thin strip and the knot hit-targets were too small to grab with a finger. This restructures the narrow-viewport layout and enlarges the touch targets.

What changed

Mobile layout restructure (FxHardwarePanel.tsx)

  • On < 640 px, the LCD now takes its own full-width row at 96 px tall (was sharing a row with the encoders at fixed 158×78 px and getting squeezed to a strip).
  • Below it sits a horizontal row [mode buttons | encoder1 | encoder2].
  • Pad grid wraps underneath as before.
  • LCD_STYLE is now a lcdStyle(narrow) helper; Lcd, LcdEnvelopeView, and ScreenModeColumn thread a narrow prop.
  • padBodyHeightNarrow() recomputed for the new three-row structure.

ENV plot scales with the new LCD

  • LcdEnvelopeView plot height is narrow ? 84 : 66 SVG units.
  • SVG gets height="100%" and touchAction:"none" (defence in depth — some mobile browsers ignore touch-action on the inner <g> and steal the drag for page scroll).

ADSR knot hit-target (AdsrNode)

  • r=9 → r=14 SVG units → ~30 px tap diameter on a typical mobile LCD width, close to Apple HIG without overlapping neighbouring knots.

Mode buttons P/E

  • 14×11 → 18×14 px, label 7 → 9 px, LED 3 → 4 px. Visible bump while staying skeuomorphic.

Why

User reported on touch device: ENV screen renders as "schmaler Streifen ohne Inhalt", knots not draggable, P/E switches too tiny.

Root cause: the LCD plate was hardcoded to width: 158 but lived in a flex-row without shrink-0, so on a 360 px phone the encoder pair (50 + 50 + gap) plus the mode column shrank the LCD container to almost nothing. The SVG's preserveAspectRatio="none" then stretched the curve into a sliver, and the r=9 hit-targets ended up only a few screen pixels across.

Test plan

  • Open the editor on an iPhone-class viewport (≤ 390 px). LCD spans the full panel width; ENV curve and knots clearly visible.
  • Tap each ADSR knot (A, D, S) and drag — should grab on first tap, no page-scroll hijack during drag.
  • Double-tap a knot — envelope resets to default.
  • Tap "P" / "E" buttons — visibly bigger, switch the LCD between params and envelope view.
  • On desktop (> 640 px), wide layout unchanged — same Mode-Buttons | LCD | Encoders | Pads row.
  • Hold a pad in paused-preview mode — EnvelopePlayhead still animates the curve correctly.
  • npm test — 604 unit tests pass.

🤖 Generated with Claude Code

The ENV-mode LCD was collapsing to a thin strip on mobile because the
158×78 LCD plate sat in a flex-row with the encoders without `shrink-0`.
On a narrow viewport, restructure the FX panel so the LCD takes its own
full-width row (96 px tall) with mode buttons + encoders horizontally
underneath, then the pad grid wraps below.

Also enlarge the P/E mode-switch buttons (14×11 → 18×14) and grow the
ADSR knot hit-target from r=9 to r=14 SVG units (~30 px tap diameter on
mobile) so envelope points are reliably draggable with a finger.
`touchAction:"none"` is now also set on the SVG itself for browsers
that don't honour it on `<g>` subnodes during knot drag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 96101d7 into main May 2, 2026
1 check passed
@johannboehme
johannboehme deleted the claude/mystifying-montalcini-849318 branch May 2, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0