Packagecom.yworks.canvas.input
Classpublic class HitTestUtil
InheritanceHitTestUtil Inheritance Object

Utility class for hit testing.



Public Methods
 MethodDefined By
  
getClosestHits(modelItems:Iterator, context:ICanvasContext, location:IPoint, precision:Number = 0.001):Iterator
[static] From the given list of IModelItems those closest to the given location are returned.
HitTestUtil
Method Detail
getClosestHits()method
public static function getClosestHits(modelItems:Iterator, context:ICanvasContext, location:IPoint, precision:Number = 0.001):Iterator

From the given list of IModelItems those closest to the given location are returned. An item is considered closest if no other item is closer to the location by more than the given precision. The IHitTestables found in the lookup of the model items are used to determine the closest items.

Parameters

modelItems:Iterator — The model items to filter for the closest.
 
context:ICanvasContext — The context the hit test takes place.
 
location:IPoint — The location the items shall be closest to.
 
precision:Number (default = 0.001) — The maximum value the distances of several model items to the location may differ so they are still considered closest.

Returns
Iterator — Those model items that are closest to the given location.