PAINTROID-798: Fix black line while using eraser and enable real-time erasing#133
Merged
juliajulie95 merged 3 commits intoCatrobat:developfrom Dec 3, 2025
Merged
Conversation
Contributor
|
Could you please remove the comments? :) |
Contributor
Author
|
Hi @juliajulie95, |
Contributor
|
Thank you for the changes, I'll test and merge this in the next week :) |
juliajulie95
approved these changes
Dec 3, 2025
Contributor
|
Thank you! |
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.
Fix: PAINTROID-798 - Black line while using eraser
Reference: Jira ticket
Refactorings and Bug Fixes
canvas.saveLayer()to properly composite cached image with eraser strokeSummary
Problem: When using the eraser tool, a black line appeared while dragging. Content only appeared erased after lifting the finger from the screen.
Root Cause:
BlendMode.clearwas being applied without proper layer composition, causing the eraser stroke to render as black during the drawing operation. The erasing effect only became visible after the gesture ended.Solution:
CommandPainterto wrap cached image and current eraser stroke incanvas.saveLayer()when eraser is actively drawingCanvasPainterto passcachedImageto the painter and conditionally hide it during active erasing to prevent double-renderingBlendMode.clearto erase against existing content within the same rendering layer, enabling real-time erasing as the finger moves without needing to lift itResult:
Files Changed:
lib/core/commands/command_painter.dartlib/ui/pages/workspace_page/components/drawing_surface/canvas_painter.dartTesting: All 75 integration tests passed, including 5 eraser-specific tests
Checklist
Note: I was unable to comment on the Jira ticket as I don't have commenting permissions yet. I've requested access to properly follow the contribution workflow for future PRs.