Skip to content

Pencil: Edit Selected Paths redraws a selected compound path - #4220

Merged
bflatastic merged 1 commit into
storytold:mainfrom
ncic:pencil-redraw-compound
Oct 26, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
ncic:pencil-redraw-compound

Conversation

@ncic

@ncic ncic commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4219.

A selected compound path (a shape with a hole) couldn't be redrawn with the Pencil or the Paintbrush. The stroke drew a new path instead, which then took over the selection, so redrawing seemed to stop working for the rest of the session on that shape.

What changes

  1. The press finds a compound path's member paths. find_redraw now also looks at the paths inside a selected compound path and picks the nearest one within Edit selected paths within.
  2. The compound path stays selected. After the redraw, path.freehand keeps the compound path selected (or, with Keep selected off, takes it out of the selection), so the next stroke redraws it too.

Tests

  • pencil_redraws_a_selected_compound_path redraws the outer path and then the hole of a selected compound path, with no new path drawn and the compound path still selected. It fails without this change.

cargo xtask ci passes (all 12 steps, Linux, Rust 1.99.0).


Worked together with Claude Code Opus 5.5 High ❤️

Summary by CodeRabbit

  • New Features
    • Pencil redraws now work on selected compound paths. Drawing over an outer boundary or hole updates the corresponding path while keeping the compound path selected.
  • Bug Fixes
    • Redrawing a path within a compound no longer targets the individual member for selection; the compound path remains the selection target.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

Pencil redraw lookup now finds editable members of a selected compound path. A successful redraw returns the member path’s ID and applies selection changes to its compound parent. A test covers redraws on the outer contour and hole while keeping the compound path selected.

Changes: Compound path redraw

Layer / File(s) Summary
Find redraw targets
crates/tools/src/draw2/gesture.rs
Redraw lookup now checks selected paths and editable members of selected compound paths. It returns the nearest matching member within the edit tolerance.
Preserve compound selection
crates/engine/src/cmd/draw2.rs, crates/engine/src/tests_draw2.rs
Successful redraws apply keepSelected to the compound parent when one exists, while returning the member path’s ID. The test checks redraws on the outer contour and hole and verifies that no top-level path is added and the compound remains selected.

Priority: Pending latest changes

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: bflatastic

Merge Risk: Minimal · up to f541f

The compound-path redraw and selection behavior appears ready to merge after normal checks.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

… paths

A selected compound path (a shape with a hole, such as one made with
Object › Compound Path › Make) could not be redrawn with the Pencil or
the Paintbrush: at the press, find_redraw looked only for selected
objects that are paths themselves, and a compound path's paths are its
children. The stroke then drew a new path, which Keep selected selected
in place of the compound path, so every later stroke near the shape drew
a new path too: redrawing seemed to stop working.

- find_redraw takes a selected compound path's member paths as well,
  the nearest one within Edit selected paths within of the press.
- path.freehand's redraw keeps the compound path selected (or, with Keep
  selected off, takes it out of the selection) when the redrawn path is
  one of its members, so the next stroke redraws it too.

Test: pencil_redraws_a_selected_compound_path redraws the outer path and
then the hole of a selected compound path; it fails without this change
(the first stroke draws a new path).

cargo xtask ci: every step passes except one test in `test`,
vectorcraft-pdf tests_import_fidelity::text_becomes_point_type, which
fails the same way on unmodified main on this machine; it is unrelated
to this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bflatastic
bflatastic force-pushed the pencil-redraw-compound branch from f541f94 to 2047676 Compare October 26, 2026 04:52
@bflatastic
bflatastic merged commit e466320 into storytold:main Oct 26, 2026
1 check passed
@bflatastic

Copy link
Copy Markdown
Member

Merged, thanks @ncic! A shape with a hole now redraws like any other path.

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.

Pencil: Edit Selected Paths can't redraw a selected compound path (a shape with a hole)

2 participants