-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(eraser_brush): erasable=deep
#7100
Conversation
This reverts commit 02f3360.
This reverts commit 196867a.
This fixes eraser being positioned against current object transform instead of initial object transform
This reverts commit 302a23b.
This reverts commit cce4ac1.
handle transform in dedicated clip path group instead of in canvas
Only erasable objects will be visibly affected by the eraser brush. * In order to support selective erasing all non erasable objects are rendered on the main ctx * while the entire canvas is rendered on the top ctx. * When erasing occurs, the path clips the top ctx and reveals the main ctx. * This achieves the desired effect of seeming to erase only erasable objects.
This reverts commit 10bbfae.
This reverts commit 96cddc2.
object was not informed of change
enable calling `applyEraserToObjects` without relation to erasable prop
Updated CHANGELOG |
so it will pass for group/collection subclasses
@asturur This PR fixes a major bug and adds a major feature. It is sad seeing it going stale. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is fine, i have no time arguing over the deep/erasable naming. |
Thanks! |
Argue is the wrong word, I apologize. I just meant is not a detail to which i can dedicate time nor stop you with. |
You are right
Thanks again
בתאריך יום ג׳, 27 ביולי 2021, 19:10, מאת Andrea Bogazzi <
***@***.***>:
… Argue is the wrong word, I apologize. I just meant is not a detail to
which i can dedicate time nor stop you with.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7100 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIGAW4KGM2VVB6G7PXXBOE3TZ3K6XANCNFSM46DBLHUQ>
.
|
Changes
This PR introduces fine grained control over a group's
erasable
property.Added erasable property value:
deep
,erasable
now acceptsboolean | 'deep'
.The
deep
option will erase nested objects in a group if they are erasable,true
will erase the entire group (once the group changes the eraser is propagated to its children for proper functionality),false
will leave all objects including the group untouched.Fixes
SprayBrush
orCircleBrush
.erasable
property is set totrue
.Test It
https://codesandbox.io/s/exciting-architecture-bcgej?file=/src/App.tsx
Motivation
Originally posted by @matsu-motsu in #6994 (comment)
Context
Behavior before this PR
Once erasing started
EraserBrush
traversed through all objects, nested or not to render the layers for erasing.Once erasing had completed (
mouseup
) all objects were iterated through, including objects that were nested in groups. If an object was erasable a path would have been added to it's eraser.EraserBrush
didn't add erasing paths to groups to enable a group to have both erasable and non erasable objects.In the case of
SprayBrush
, what happened was:This behavior is exactly what the
deep
option does and is undesirable as default behavior as shown above.So now, with this PR, a single path will be added only to the group's eraser as long as
erasable=true
and that's it.This tests object and canvas resizing with eraser:
https://codesandbox.io/s/romantic-williams-fwbz9?file=/src/App.tsx
Erase the blue overlay and then change the canvas size by dragging the window borders. Notice that the eraser is now sized automatically; the red rect changes size while it's eraser stays in place.
Originally posted by @ShaMan123 in #7100 (comment)
SOLVED 82a3d7d -> e2c6774
https://codesandbox.io/s/angry-browser-49sc3?file=/src/EraserBrush.js
Originally posted by @ShaMan123 in #7100 (comment)