Repository navigation
Draw: the live pen stroke is drawn as the ink it commits (fixes #1786) - #3229
Conversation
While dragging with a pen, the stroke under the pointer was always painted blue at 2 pt, whatever pen or highlighter was chosen, so the preview and the committed ink disagreed (a highlighter previewed as a thin blue line). The preview now uses the colour and width draw.stroke stores (pen blue and 2 pt by default, 0.5-40 pt, whole points) and the translucency Ink shapes are painted with above 8 pt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review |
Action performed
|
…n and once committed Addresses CodeRabbit review on storytold#3229, "Use the same translucency threshold as committed ink": the preview judged the pen by its width in points, the committed stroke by its width on screen, so at 50% a 12 pt highlighter turned opaque once committed and at 200% a 6 pt pen turned translucent. Both now use chartview::ink_color, which goes by the stroke's width in points, so the two agree and neither changes with the zoom. Test: ink_render::ink_translucency_follows_the_pen_not_the_zoom. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged — thank you @hectorviov for the contribution! |
Fixes #1786
What
While you drag with a pen on the Draw tab, the stroke under the pointer was always painted blue at 2 pt, whatever pen or highlighter was chosen. The committed stroke uses the chosen pen, so the preview and the result disagreed: a yellow highlighter previewed as a thin blue line. In Excel the line you draw is the ink that will be committed.
crates/ui-egui/src/grid/interact.rsgetspen_ink(color, width, theme), which gives the colour and width the stroke will have:draw.strokestores it (2 pt by default, 0.5–40 pt, whole points);The live preview uses it.
Comparison
Excel: the line under the pointer is the ink that will be committed, as the issue describes. I couldn't draw with a pen in Excel on this machine (pointer drags there didn't register), so that column wasn't observed by me.
Tests
grid::interact::tests::the_pen_preview_is_the_ink_the_stroke_commitscovers a pen colour and width, the defaults, a bad colour and a too-thin width, and a translucent highlighter. It fails when the helper returns the old constant (blue, 2 pt).cargo xtask cipasses.Anything a reviewer should look at first
draw.strokeandchartviewalready do, so the preview can't drift from the committed ink without one of those tests noticing. If you'd prefer, the threshold could become a shared constant in the engine.docs/ui-parity.mdgets a change note and a revision row.🤖 Generated with Claude Code
Summary by CodeRabbit