Skip to content

SQLBI Whiteboard 1.1.1

Choose a tag to compare

@marcosqlbi marcosqlbi released this 26 Aug 18:24
825cf96
Collect pen ink from the pen, and add straight-line strokes (#73)

Straight-line strokes on Shift and on the pen's barrel button, and the
ink path
that had to change for the button to work at all.

## Straight lines

Holding Shift, or the barrel button when it is assigned to Straight
line,
constrains the stroke to horizontal or vertical — whichever the first 24
px of
travel is nearer — at a uniform width. The axis is settled once and kept
for the
whole segment, however far off it the hand drifts. Press or release at
any time:
the part already drawn stays straight and the rest goes freehand from
there.

## Why the ink path changed

On a pen whose barrel switch shares its report with the tip switch,
pressing or
releasing that button fabricates a stylus up followed by a stylus down,
and
between a release and the next press the driver reports the tip as open
while it
is still pressing. WPF tears the contact in two on every click and calls
the pen
airborne in between, so an `InkCanvas` stroke joined stretches the pen
never drew
and lost the ones it did. Several attempts to repair that from inside
the
InkCanvas each moved the fault rather than removing it.

The pen's own packet stream never breaks — a trace of a real session
established
that — so `MainWindow.AppendPenInk` now reads it directly and owns the
contact,
the straight-line constraint and the calligraphy dynamics, with
`BoardSurface.PendingStroke` drawing the wet stroke. The constraint is
then one
boolean read per point, which is what makes the button behave exactly
like Shift:
neither has any opinion about whether WPF thinks the pen is down.
Recorded as
decision 22.

`PenOnlyInkCanvas` becomes `TouchInkCanvas` and keeps the InkCanvas for
finger
ink only, where nothing tears the contact.

## Pen buttons

One configurable barrel button, Laser (default) or Straight line.
Erasing is not
assignable: the reverse end of the pen erases, and so does the upper
side button,
because Windows describes both by inverting the stylus and the trace
shows the
two producing identical events on this hardware. `PenTrace` — off unless
`SQLBI_WHITEBOARD_PENTRACE` names a file — is what settled that, and is
kept for
the next pen question.

## Preferences

Pen button, Toolbar position and Toolbar layout now draw their options
instead of
naming them, sharing one builder with the laser trail weights.

## Also

Version 1.1.1. README architecture notes, `site/shortcuts.html` and
`site/guide.html` brought up to date; TODO records the hardware findings
and the
two constants that stand in for signals the hardware does not give.

Release build clean with `TreatWarningsAsErrors`, smoke tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Alberto Ferrari <alberto.ferrari@sqlbi.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>