feat: Shape Pen UX follow-ups and more forgiving recognition - #393
Merged
Merged
Conversation
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.
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.
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
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.
drawing.shape_recognition_grid_snapsetting (defaulttrue), also a configurator switch, turns grid snapping off.Feedback and correction
Discoverability and controls
Sas its default key. On very narrow strips it is the first pen to move into the overflow menu.Fixes and performance
Behavior changes for existing users
S