-
-
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(EraserBrush): V2 #7470
feat(EraserBrush): V2 #7470
Conversation
render only erased parts of objects so not to double opacity of objects.
I want a way to check performance compared to prev version. |
You can use the inspector of google chrome. |
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. |
ShaMan123, i found after erased an image. this image can not use clipPath to clip any polygon again. |
What about changelog? |
CHANGELOG committed |
Can you fix the dist folder? i tried but i can't fixing it by check out |
try from commandline with the classic |
DONE! |
do we need to merge the second one now? |
yes. |
Well no. I'll shut it down |
the case still have edge when using inverted eraser,to implement the feature, only need globalCompositionOperation |
@komagic if you've encountered a bug do open a bug report. There's no way to understand what you are experiencing. |
my comment still stands. |
The eraser has moved https://github.com/ShaMan123/erase2d |
UPDATE
The eraser has moved https://github.com/ShaMan123/erase2d
Motivation
Solves eraser problem (opaic objects) by applying a mask over the brush.
As a side effect solved other problems such as deep clipping and erasing.
And enabled the awesome feature of undoing erasing.
While boosting performance so it seems.
Previous Drawing Logic
Render objects in 3 steps:
This was great except when you had a non erasable opaic object. It would draw on step 1 and 2, doubling itself.
Trying to solve it in context would not work, somewhere it would still be doubled or missing.
Current Drawing Logic
While erasing:
This approach supports
inverted
erasing, AKA recovering, out of the box. We simply produce a mask rendered with all erasable objects with their eraser (clip path) inverted.Use this feature as follows:
Outcome
Try it out
https://codesandbox.io/s/2hhyp
https://codesandbox.io/s/soz8h (tests erasing with inverted and nested clip paths - erase and select objects to see)
The left top circle is opaic and not erasable.
Migration from V1
The Eraser object is now a subclass of Group. This means that loading from JSON will break between versions.
Use this code to transform your json payload to the new version.
Perf
Next
I've pushed the use of clipping beyond the limit of
svg
. It seems fabric has advanced further thansvg
in clipping abilities sotoSVG
should be amended to using masks, not clip paths in order to support all functionalities.