mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Improve testOnCurve() code.
This commit is contained in:
parent
98efa2f66b
commit
81b4136775
1 changed files with 9 additions and 11 deletions
|
@ -254,19 +254,17 @@ PathItem.inject(new function() {
|
|||
}
|
||||
|
||||
function testOnCurve(path, point) {
|
||||
var res = 0;
|
||||
var crv = path.getCurves();
|
||||
var i = 0;
|
||||
var bounds = path.bounds;
|
||||
if (bounds && bounds.contains(point)) {
|
||||
for(i = 0; i < crv.length && !res; i++) {
|
||||
var crvi = crv[i];
|
||||
if (crvi.bounds.contains(point) && crvi.getParameterOf(point)) {
|
||||
res = 1;
|
||||
}
|
||||
var curves = path.getCurves(),
|
||||
bounds = path.getBounds();
|
||||
if (bounds.contains(point)) {
|
||||
for (var i = 0, l = curves.length; i < l; i++) {
|
||||
var curve = curves[i];
|
||||
if (curve.getBounds().contains(point)
|
||||
&& curve.getParameterOf(point))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
// A boolean operator is a binary operator function of the form
|
||||
|
|
Loading…
Reference in a new issue