Skip to content

fix(canvas): improve Lasso start surfaces and sampling fidelity - #304

Merged
Liangwei Wang (LiangweiOIO) merged 2 commits into
mainfrom
fix/lasso-start-and-sampling
Oct 14, 2026
Merged

Liangwei Wang (LiangweiOIO) merged 2 commits into
mainfrom
fix/lasso-start-and-sampling

Conversation

@LiangweiOIO

Copy link
Copy Markdown
Collaborator

Summary

  • Allow Lasso to start on non-interactive node surfaces, including Notes, Images, Frames, and selected Sketch bounds, while preserving controls and editors.
  • Preserve every distinct pointer sample, including browser-coalesced samples, instead of replacing nearby endpoints and losing curve features. Publish selection preview once per dispatched event.
  • Reuse the area-selection click guard for retained Ink movement so trailing clicks cannot dismiss a moved selection.
  • Update Canvas and Sketch architecture docs and add regression coverage.

Validation

  • 127 targeted unit tests passed across 8 files, covering Lasso, input policy, marquee, geometry, and retained movement.
  • 3 Playwright tests passed: empty-pane selection, dense 2px Lasso starting inside a selected Note, and dense 2px Lasso starting inside selected Sketch bounds; both new cases verify retained-region movement.
  • Repository pnpm typecheck and pnpm format passed.
  • Changed-file ESLint and git diff --check passed.
  • Ran repository pnpm lint:fix: its 5 errors are confined to the local-only, Git-ignored tmp/dev-ipad.mjs script (undefined console/setTimeout). Repository ESLint passes with that single local file excluded; existing warnings remain.
  • Pre-push typecheck and i18n parity checks passed.
  • Physical pen/iPad hardware validation remains manual.

Scope

Only the 11 Lasso-related source, test, and documentation files are included. Existing local desktop-startup changes are excluded.

Allow Lasso starts on non-interactive node surfaces, preserve coalesced and densely sampled pointer paths, and guard retained Ink moves against trailing clicks. Update interaction docs and cover routing, sampling, and retained movement with regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new target policy incorrectly lets Lasso capture the Audio node’s seek slider, preventing seeking while Lasso is active.

1 open finding
What changed in this PR

Expands Canvas Lasso initiation across non-interactive node surfaces while improving pointer-sample fidelity and retained-selection movement handling.

Changes:

  • Enables Lasso on node surfaces while reserving editors and controls.
  • Preserves coalesced pointer samples and adds click suppression for moved Ink.
  • Adds architecture documentation and regression coverage.
File Description
docs/​architecture/​sketch-node.md Documents Lasso behavior for Sketch nodes.
docs/​architecture/​canvas-input-interactions.md Updates the Canvas gesture contract.
apps/​web/​src/​index.css Shows the Lasso cursor over nodes.
apps/​web/​src/​hooks/​useSketchStrokeMove.ts Guards compatibility clicks after retained movement.
apps/​web/​src/​hooks/​useSketchStrokeMove.test.tsx Tests retained-movement click suppression.
apps/​web/​src/​hooks/​useCanvasLasso.ts Captures node-originated and coalesced pointer samples.
apps/​web/​src/​hooks/​useCanvasLasso.gesture.test.tsx Tests node starts and sampling fidelity.
apps/​web/​src/​components/​Panels/​Canvas/​canvasInputPolicy.ts Broadens eligible Lasso start targets.
apps/​web/​src/​components/​Panels/​Canvas/​canvasInputPolicy.test.ts Tests allowed surfaces and excluded controls.
apps/​web/​src/​components/​Panels/​Canvas/​Canvas.tsx Connects native routed events and click guarding.
apps/​web/​e2e/​canvas-mouse.spec.ts Adds Note and Sketch Lasso scenarios.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return (
!isPanelTarget(target) &&
!isNodeControlTarget(target) &&
!isKeyboardInteractiveTarget(target) &&

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1540905. The shared interactive-target predicate now recognizes role="slider" and its descendants. New Lasso drawing and retained-region movement share the same control exclusions, so an existing retained region cannot capture the Audio seek bar either.

Added policy regressions (confirmed failing before the fix) and a real WAV-backed Playwright test that clicks a waveform child, checks audio.currentTime and focus, then verifies ArrowRight/ArrowLeft seeking both with and without a retained region. Validation: 172 targeted unit tests, 4 browser tests, repository typecheck/format, and changed-file lint passed. The existing local-only tmp/dev-ipad.mjs lint issue is unchanged.

Recognize ARIA sliders in the shared interactive-target predicate and apply the same control exclusions to new and retained Lasso gestures. Add control-policy regression tests and a real WAV-backed browser test for pointer seeking, focus, and arrow-key seeking with and without a retained region.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@LiangweiOIO
Liangwei Wang (LiangweiOIO) merged commit bdb24ab into main Oct 14, 2026
7 checks passed
@LiangweiOIO
Liangwei Wang (LiangweiOIO) deleted the fix/lasso-start-and-sampling branch October 14, 2026 10:02
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.

2 participants