Skip to content

feat: Shape Pen UX follow-ups and more forgiving recognition - #393

Merged
devmobasa merged 11 commits into
mainfrom
feat/shape-pen-ux
Sep 25, 2026
Merged

devmobasa merged 11 commits into
mainfrom
feat/shape-pen-ux

Conversation

@devmobasa

Copy link
Copy Markdown
Owner

Follow-up to #392 (Shape Pen, #391): make Shape Pen easier to find, easier to correct, and more willing to recognize quick hand-drawn shapes. Triangle recognition landed separately on main (99a1ee5).
Recognition

  • Rectangles drawn quickly by hand, with tilted, skewed, or rounded sides, are now recognized:
    when the bounding-box fit fails, a corner-based fit accepts sides that lean up to 12° + 4° per sensitivity level and squares them up.
  • The default sensitivity rises from 2 to 3. Level 4 remains the most forgiving.
  • Recognized rectangles and ovals snap their edges to nearby Cartesian grid lines, and triangle corners snap to Cartesian lines or isometric points. The new
    drawing.shape_recognition_grid_snap setting (default true), also a configurator switch, turns grid snapping off.
  • Recognized ovals, rectangles, and triangles follow the Fill toggle.

Feedback and correction

  • The preview draws the recognized shape over a faint copy of the stroke.
  • The size badge names the shape release will commit ("Triangle 120 × 90", "Line 140") and stays hidden while the stroke is ink.
  • The first undo turns a recognized shape back into its original stroke; the second removes it.

Discoverability and controls

  • Shape Pen sits next to Pen on the full toolbar (simple mode keeps it in the Shapes picker), with S as its default key. On very narrow strips it is the first pen to move into the overflow menu.
  • A Sensitivity stepper in Shape Pen's style pill, plus unbound Increase/Decrease Shape Pen Sensitivity actions. The level is saved with the session, like pen smoothing.
  • The tool is called "Shape Pen" everywhere (previously also "Live Shaping Tool" and "Shape pen").

Fixes and performance

  • Releasing a stroke that previewed as a shape but commits as ink now repaints the whole preview, instead of leaving stray pixels.
  • Recognition runs once per pointer move instead of 2–4 times. While the preview is plain ink, only the new segment is repainted, like the pen.

Behavior changes for existing users

  • New default binding S

Recognized ellipses, rectangles, and triangles were always unfilled even
though the Shapes popover offers Fill while Shape Pen is active. They now
follow the toggle like the dedicated shape tools, and Shape Pen's style
pill shows the Fill control.
The palette, tooltip, and help called it "Live Shaping Tool" while the
toolbar said "Shape Pen" and the configurator "Shape pen". Use "Shape
Pen" everywhere, with "Shape Pen Tool" where other tools read "Pen Tool"
or "Line Tool". Also cover its toolbar icon in the painter test.
While drawing with Shape Pen, the shape readout badge now says what
release will commit, such as "Triangle 120 × 90" or "Line 140", and
stays hidden while the stroke is still ink. The rectangle and ellipse
tools keep their plain width and height readout.
Shape Pen sensitivity could only be set in the config file or the
configurator, and took effect after reopening the overlay. Add a
Sensitivity stepper to Shape Pen's style pill, unbound Increase and
Decrease Shape Pen Sensitivity actions with a toast, and remember the
level with the session like pen smoothing. The config value is the
starting level.
Shape Pen lived only in the Shapes picker and had no shortcut. In the
full toolbar it now sits next to Pen, and it no longer repeats in the
full-mode picker; simple mode keeps it in the picker. Press S to select it.
On a very narrow strip it is the first pen to move into the overflow menu,
since the key and the command palette still reach it.
A recognized stroke used to replace its ink outright, so undo removed the
whole stroke. It now enters history as the ink and then becomes the shape
as a second step: the first undo gives the original stroke back, and the
second removes it. Strokes that stay ink are still one step.
The live preview swapped the ink for the recognized shape without a
trace, and swapped it back if the stroke stopped fitting. The preview now
draws the recognized shape over a faint copy of the stroke, so it is clear
what was recognized and nothing jumps when the stroke turns back into ink.
The preview damage covers both.
Only recognized lines snapped to the board grid, and snapping could not
be turned off. Rectangle and oval edges now snap to nearby Cartesian lines,
and triangle corners to nearby Cartesian lines or isometric lattice points,
using the same margin as lines. A snap that would collapse a shape is
skipped.

drawing.shape_recognition_grid_snap (default true), also on the
configurator's Drawing page as "Snap Shape Pen to board paper", turns
grid snapping off. Axis alignment still applies.
Quick mouse rectangles with a tilted, leaning, or rounded side stayed ink
at the default level, because the rectangle fit compared the stroke with
its bounding box. When that fit fails, find the four corners, fit a line
through each side, and accept sides that alternate between roughly
horizontal and roughly vertical, leaning up to 12 degrees plus 4 per
sensitivity level. The rectangle takes each side's average position.

Also raise the default sensitivity from 2 to 3. Level 4 remains the most
forgiving, and one undo returns the ink when recognition guesses wrong.

The triangle fit now shares its resampling and side fitting with the new
fallback in live_shape/outline.rs.
The preview, its damage bounds, and the shape readout each ran
recognition over the whole stroke on every pointer move. A per-stroke memo
keyed by the stroke's length, ends, and settings now shares one run, and
it is reset when the next stroke starts.

Shape Pen also opted out of append-only damage, so every move repainted
the whole stroke's box. While the preview stays plain ink it now damages
only the new segment, like the pen; a recognized shape, or a switch
between ink and shape, still repaints the full preview.
If the last preview showed a recognized shape and the release point
tipped the stroke back into ink, release repainted only the ink's own
path. Parts of the preview that sat off the ink, such as an edge snapped
to the grid, stayed on screen until something else repainted them.
Release now repaints the whole previous preview in that case.
@devmobasa
devmobasa merged commit 009f842 into main Sep 25, 2026
3 checks passed
@devmobasa
devmobasa deleted the feat/shape-pen-ux branch September 25, 2026 18:29
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