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

Boolean operations not working in certain cases #3

Open
priyanka-herur opened this issue Jul 3, 2013 · 4 comments
Open

Boolean operations not working in certain cases #3

priyanka-herur opened this issue Jul 3, 2013 · 4 comments

Comments

@priyanka-herur
Copy link

I had earlier logged an issue with boolean operations working incorrectly.
Now, on the same SVG elements, I don't see the boolean operation being applied at all.
The computed pathString is null.
The sample code is present at the following link:
http://jsfiddle.net/f7hpX/

@poilu
Copy link
Owner

poilu commented Jul 3, 2013

There is a problem in the function that is supposed to find out, wether a segment of a path is inside the other path or not (isSegInsidePath). This relies on the Raphael utility method isPointInsidePath, which seems to be buggy.

@poilu
Copy link
Owner

poilu commented Jul 3, 2013

As a workaround you could use a isPointInsidePath method, which is slightly different from the original one. Load it after the library to override it. This seems to fix the issues, but I'm not sure if it works in all cases.

Raphael.isPointInsidePath = function (path, x, y) {
    var bbox = Raphael.pathBBox(path);
    return Raphael.isPointInsideBBox(bbox, x, y) &&
       Raphael.pathIntersectionNumber(path, [["M", x, y], ["L", bbox.x2 + 10, bbox.y2 + 10]], 1) % 2 == 1;
};

@maxime-aubry
Copy link

Hi.
I try to use your plugin, but i also found a bug. I need to resolve as fast as possible for a project. Could you help me please ?

http://jsfiddle.net/maubry/g0dyLj8w/

Thanks :)

@samhocevar
Copy link
Contributor

I am unable to reproduce @priyanka-herur ’s bug; maybe it was indirectly fixed in Raphael.js.

I believe this issue can be closed, because the bug reported by @maxime-aubry seems to be a consequence of #11.

samhocevar added a commit to samhocevar-forks/raphael-boolean that referenced this issue Mar 5, 2021
This works around a Raphael.isPointInsidePath limitation. There was a workaround
mentioned in poilu#3 (comment)
but it is vulnerable to corner cases. A fix was also proposed upstream at
DmitryBaranovskiy/raphael#1131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants