Skip to content
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

Binary operations on SVG objects #4977

Closed
paulbrzeski opened this issue May 18, 2018 · 7 comments
Closed

Binary operations on SVG objects #4977

paulbrzeski opened this issue May 18, 2018 · 7 comments
Labels
stale Issue marked as stale by the stale bot

Comments

@paulbrzeski
Copy link

I couldn't find a way to do binary operations on SVG objects in Fabric. I want to be able to perform operations like add/subtract between a circle and a square.

Example in Paper.JS: http://paperjs.org/examples/boolean-operations/
Implementation in Adobe Illustrator - https://cdn.tutsplus.com/vector/uploads/legacy/tuts/232_Comprehensive_Pathfinder/00_Panel.jpg

Has anyone implemented functionality like this in Fabric.JS and/or would anyone be interested in developing it? I'm currently looking into loading up Paper.JS in my application alongside Fabric just to do the operations but if someone has a suggestion I'll take it :)

Apologies if this has been posted before but I couldn't an example of this anywhere.

@asturur
Copy link
Member

asturur commented May 18, 2018

Definitely that is a feature we want to have for paths.
It would probably works on path only ( no circle, no rect unless they get converted to paths )

@melchiar
Copy link
Member

I second this as a great feature addition! For now though, you can always use Maker JS as a supporting library since it can perform all of the common boolean operations on path data. It can be a bit slow and buggy though, so certainly a native solution would be preferable.

@stale
Copy link

stale bot commented Jan 26, 2020

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.

@stale stale bot added the stale Issue marked as stale by the stale bot label Jan 26, 2020
@stale stale bot closed this as completed Feb 2, 2020
@Baoyuantop
Copy link

Is there a better solution to this problem now?

@asturur
Copy link
Member

asturur commented Aug 20, 2020

No. I would not mind having that logic in fabric.util.intersectPath(pathA, pathB) and similar.

@NaveenEdala
Copy link

Any way to do this yet? I am still struggling to reliably do this with globalCompositeOperations and such!

@asturur
Copy link
Member

asturur commented May 31, 2024

You could check what paperJS is doing and just implement theyr function or try to use it on our paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue marked as stale by the stale bot
Projects
None yet
Development

No branches or pull requests

5 participants