Friday, 15 April 2011

paperjs - Hit test with a radius on a point -


The following code in the paper.js structure performs a hit at the point of coordinate of mouse coordination. Function OnMouseUp (Events) {var hitOptions = {Stroke: Wrong, Fill: Correct, Tolerance: 2}; Var hitResult = project.hitTest (event.point, hitOptions); }

I want to do this that I have to do this exam within the given radius of event.point (), but I have not found any way yet.

Any thoughts?

UPDATE

I think the way I was setting the option should be ignored. The following code works:

  var hitOptions = {fill: true, stroke: true, Segment: true, tolerance: 200}; Var hitResult = project.hitTest (event.point, hitOptions); Alert (hitResult);  

It seems that due to a bug the tolerance option is not read. You can manually change the tolerance by modifying the line 3631 (at night). For example, if you want a test radius of 200 points:

  Tolerance: paper.project.options.hitTolerance || 2   

to:

  Tolerance: paper.project.options.hitTolerance || 200    

No comments:

Post a Comment