-
Notifications
You must be signed in to change notification settings - Fork 6
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
Comments
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. |
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;
}; |
Hi. http://jsfiddle.net/maubry/g0dyLj8w/ Thanks :) |
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. |
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
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/
The text was updated successfully, but these errors were encountered: