Skip to content

fix: smooth freehand stroke capture - #585

Merged
vibhavkatre merged 2 commits into
frappe:mainfrom
bvnaik05:fix/574-smooth-pen-strokes
Sep 1, 2026
Merged

fix: smooth freehand stroke capture#585
vibhavkatre merged 2 commits into
frappe:mainfrom
bvnaik05:fix/574-smooth-pen-strokes

Conversation

@bvnaik05

@bvnaik05 bvnaik05 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closes #574

What changed

Freehand capture now keeps a more useful distance between stored anchors, with a wider threshold for wider ink. The committed-path rendering contract is unchanged.

Why it matters

Slow strokes retain their intended shape while filtering the dense, low-amplitude samples that make them look mechanical.

Verified

  • yarn vitest run src/composables/useWhiteboardInteraction.test.js src/diagram/svgPath.test.js
  • yarn eslint src/composables/useWhiteboardInteraction.js src/composables/useWhiteboardInteraction.test.js

Closes #574.

Copilot AI lite review requested due to automatic review settings August 31, 2026 07:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "fix: retain short wide stroke endpoints" | Re-trigger Greptile

Comment thread frontend/src/composables/useWhiteboardInteraction.js

@vibhavkatre vibhavkatre left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sound, and the endpoint guard is the part that makes it safe. Notes from checking it:

  • finishStroke has exactly one caller (useWhiteboardInteraction.js:226), so appendStrokeEndpoint can never be handed an undefined endpoint.
  • Sparser anchors do not make strokes look angular, because smoothPath draws one quadratic per point through the midpoints — wider spacing rounds the curve rather than faceting it, which is the direction #574 asks for.
  • Width-proportional thinning is the right instinct. At the widest highlighter (26) the threshold reaches ~19.5 canvas units, which is coarse in absolute terms; the smoothing hides it for ordinary highlighting, but if a tight highlighter curve ever reads as clipped, that ratio is the dial. Worth remembering it is measured in canvas units, so drawing zoomed in thins more aggressively than drawing at 100%.

Merging.

@vibhavkatre
vibhavkatre merged commit 8c468f5 into frappe:main Sep 1, 2026
4 checks passed
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.

Draw/pen tool strokes still look mechanical — hand jitter survives into the committed stroke

3 participants