-
-
Notifications
You must be signed in to change notification settings - Fork 5
How to extend EraseBrush class to make custom brush shapes? #52
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
Comments
Your code doesn't say what you want to do. I understand from it that on pointerup a polygon is created instead of a path. |
If that is the case you need to call preventDefault and pass down the polygon to the commit call from the end event. There is a detailed example in the readme |
@ShaMan123 I'm trying to create an eraser that works based on polygon shapes rather than just a freehand path. In my previous code, I used a free-drawing pencil brush to create polygon shapes. Similar to it, I want to make a polygon-based brush that erases objects below it instead of drawing. I looked at the example you sent but it does not seems to be working and giving me error saying I have created a code sandbox to show this error. Can you help me in resolving this error? Also, I’d appreciate any guidance on how to properly implement a polygon-shaped eraser. I have added the Lasso/Polygon brush tool in the sandbox to show how I want the eraser to work - I just need it to erase instead of draw. |
@ShaMan123 Thank you so much!! You are life saver, I spent so much time trying to implement this. 😊👍 |
Happy to help. |
Hello. I am currently trying to make some custom canvas brushes, such as square brush and lasso brush. I want to make them both for PencilBrush and for erasing those said Pencil lines. I was successfully able to make the lasso pencil brush like below, but I don't know how I can extend your EraserBrush to make a similar lasso eraser brush. Can you help me out with this as I am not able to understand the process of erasing by seeing your code.
The text was updated successfully, but these errors were encountered: