fix(core): normalize non-pen pressure for freehand#58
Open
enieuwy wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #57.
Summary
This normalizes freehand pressure for non-pen pointer input while preserving real pressure for pen input.
Today
BaseModel.getMousePosition()forwards rawevent.pressurefor every pointer type.StylusModelthen feeds those points intoperfect-freehandwith:thinning: 0.9simulatePressure: falseThat means non-pen inputs (
mouse,touch) can produce different saved freehand geometry at the same nominal brush size, depending on the platform/browser's reported pressure behavior.Change
Use real pressure only for pens:
This is applied in both coordinate paths of
BaseModel.getMousePosition().Why 0.5
0.5is the conventional active-pressure baseline for hardware without meaningful pressure support, and it matches the desktop mouse baseline that many browsers already use.Scope
Verification
pnpm install --frozen-lockfilepnpm build