Skip to content

Commit 0a52e95

Browse files
committed
Make isPointInsidePath() more robust by adding jitter to cast ray. Fixes #1130.
1 parent b5fdbdc commit 0a52e95

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

dev/raphael.core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ define(["eve"], function(eve) {
15551555
R.isPointInsidePath = function (path, x, y) {
15561556
var bbox = R.pathBBox(path);
15571557
return R.isPointInsideBBox(bbox, x, y) &&
1558-
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
1558+
interPathHelper(path, [["M", x, y], ["l", bbox.width + 10, Math.random()]], 1) % 2 == 1;
15591559
};
15601560
R._removedFactory = function (methodname) {
15611561
return function () {

raphael.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
16851685
R.isPointInsidePath = function (path, x, y) {
16861686
var bbox = R.pathBBox(path);
16871687
return R.isPointInsideBBox(bbox, x, y) &&
1688-
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
1688+
interPathHelper(path, [["M", x, y], ["l", bbox.width + 10, Math.random()]], 1) % 2 == 1;
16891689
};
16901690
R._removedFactory = function (methodname) {
16911691
return function () {

raphael.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

raphael.no-deps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
16851685
R.isPointInsidePath = function (path, x, y) {
16861686
var bbox = R.pathBBox(path);
16871687
return R.isPointInsideBBox(bbox, x, y) &&
1688-
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
1688+
interPathHelper(path, [["M", x, y], ["l", bbox.width + 10, Math.random()]], 1) % 2 == 1;
16891689
};
16901690
R._removedFactory = function (methodname) {
16911691
return function () {

raphael.no-deps.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)