Skip to content

feat: new area eraser#1761

Draft
Imagination-King wants to merge 4 commits into
saber-notes:mainfrom
Imagination-King:eraserSplit
Draft

feat: new area eraser#1761
Imagination-King wants to merge 4 commits into
saber-notes:mainfrom
Imagination-King:eraserSplit

Conversation

@Imagination-King

@Imagination-King Imagination-King commented Jun 5, 2026

Copy link
Copy Markdown

Closes: #40
This is my first time contributing to an open-source project, so please feel free to correct me on anything I may be doing wrong.

As requested by several users, a new eraser has been added that erases parts of a line instead of the whole line. It basically separates each affected stroke into individual points, and recalculates them back into smaller strokes after the erasing is complete. This new tool is accessible from the new eraser modal (designed to look and operate much like the pen modal), where the size of the eraser's "impact" can also be adjusted. Two new custom icons have also been added to help differentiate between the original stroke eraser and the new area eraser.


Summary by cubic

Adds a new area eraser that removes only the touched part of a stroke, plus an eraser modal to switch modes and adjust size. This improves precision erasing and adds persistence and full undo/redo support.

  • New Features

    • Area eraser: splits impacted strokes into kept segments; works across overlapping strokes.
    • Eraser modal: size slider and mode toggle between stroke eraser and area eraser; new assets/images/eraser-*.svg icons; toolbar opens modal when eraser is active; layout adapts to toolbar orientation.
    • Persistence: remembers last eraser size and mode (stows.lastEraserSize, stows.lastEraserAreaMode).
    • History: new eraseArea type records replacementStrokes for correct undo/redo.
  • Refactors

    • Eraser now keeps currentEraser, supports area mode, and returns EraserResult with erased and replacement strokes.
    • Editor and toolbar use Eraser.currentEraser; toolbar toggles the eraser modal; added ToolOptions.eraser.
    • Stroke adds pointVectors and replacePoints for partial updates.
    • i18n additions for eraser options; tests updated and added for partial erase behavior.

Note: Saber is trialling Cubic AI code review. AI output may contain mistakes, misconceptions, and hallucinations. You can act on the AI feedback if you find it helpful; otherwise you can disregard it and wait for a human reviewer.

Written for commit fbdc889. Summary will update on new commits.

…s instead of whole lines. Both area eraser and original (stroke eraser) freely accessible through new eraser modal.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 12 files

Confidence score: 4/5

  • This PR appears safe to merge overall, with one moderate UI issue rather than a functional breakage or data/security risk.
  • In lib/components/toolbar/eraser_modal.dart, the axis-dependent layout currently uses a width-only spacer, so in vertical orientation the expected spacing between controls is lost and the modal can look cramped.
  • The issue is scoped and well-defined (severity 5/10, high confidence), which suggests low-to-moderate merge risk if the vertical layout behavior is acceptable short-term.
  • Pay close attention to lib/components/toolbar/eraser_modal.dart - axis-specific spacing should be adjusted so vertical orientation preserves intended control gaps.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread lib/components/toolbar/eraser_modal.dart Outdated
@Imagination-King Imagination-King marked this pull request as draft June 18, 2026 23:05
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.86219% with 190 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.59%. Comparing base (573449f) to head (fbdc889).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
lib/components/toolbar/eraser_modal.dart 0.00% 136 Missing ⚠️
lib/data/tools/eraser.dart 76.85% 25 Missing ⚠️
lib/pages/editor/editor.dart 13.04% 20 Missing ⚠️
lib/components/toolbar/toolbar.dart 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1761      +/-   ##
==========================================
- Coverage   52.15%   51.59%   -0.57%     
==========================================
  Files         131      132       +1     
  Lines        9383     9646     +263     
==========================================
+ Hits         4894     4977      +83     
- Misses       4489     4669     +180     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@Imagination-King Imagination-King changed the title New Area Eraser feat: new area eraser Jun 19, 2026
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.

Erase parts of a line

1 participant