Skip to content

Commit

Permalink
Make isPointInsidePath() more robust by adding jitter to cast ray. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samhocevar committed Mar 3, 2021
1 parent b5fdbdc commit 0a52e95
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dev/raphael.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ define(["eve"], function(eve) {
R.isPointInsidePath = function (path, x, y) {
var bbox = R.pathBBox(path);
return R.isPointInsideBBox(bbox, x, y) &&
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
interPathHelper(path, [["M", x, y], ["l", bbox.width + 10, Math.random()]], 1) % 2 == 1;
};
R._removedFactory = function (methodname) {
return function () {
Expand Down
2 changes: 1 addition & 1 deletion raphael.js
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
R.isPointInsidePath = function (path, x, y) {
var bbox = R.pathBBox(path);
return R.isPointInsideBBox(bbox, x, y) &&
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
interPathHelper(path, [["M", x, y], ["l", bbox.width + 10, Math.random()]], 1) % 2 == 1;
};
R._removedFactory = function (methodname) {
return function () {
Expand Down
2 changes: 1 addition & 1 deletion raphael.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion raphael.no-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
R.isPointInsidePath = function (path, x, y) {
var bbox = R.pathBBox(path);
return R.isPointInsideBBox(bbox, x, y) &&
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
interPathHelper(path, [["M", x, y], ["l", bbox.width + 10, Math.random()]], 1) % 2 == 1;
};
R._removedFactory = function (methodname) {
return function () {
Expand Down
2 changes: 1 addition & 1 deletion raphael.no-deps.min.js

Large diffs are not rendered by default.

0 comments on commit 0a52e95

Please sign in to comment.