This class represents an area that objects, such as a marker, occupy in the
screen space. Such objects can be probed and returned by H.Map@getObjectsAt method.
| Name | Type | Description |
|---|---|---|
shapeType |
H.map.HitArea.ShapeType |
The shape type of the HitArea.
The shape type |
opt_coords |
Array.<number> |
optional
The coordinates to define the geometry of the shape.
All values are treated as CSS pixels in screen space.
The x-coordinates increase to the right; y-coordinates increase from top to bottom.
Every |
Throws:
-
if the
shapeTypeis not supported or theopt_coordsis invalid for the specified type.
Example
// No positive probe for the whole area:
new H.map.HitArea(H.map.HitArea.ShapeType.NONE);
// A rectangular area with a left-top corner at (10, 10) and a right-bottom corner at (30, 30):
new H.map.HitArea(H.map.HitArea.ShapeType.RECT, [10, 10, 30, 30]);
// A circular area with center at (20, 20) and a radius of 10:
new H.map.HitArea(H.map.HitArea.ShapeType.CIRCLE, [20, 20, 10]);
// A polygonal area, a triangle with corner points at (20, 10), (30, 20) and (10, 20):
new H.map.HitArea(H.map.HitArea.ShapeType.POLYGON, [20, 10, 30, 20, 10, 20]);
Members
-
The possible shape types that are supported by
HitArea.Properties:
Name Description NONENo hit area, any probe is negative
RECTA rectangular hit area, any probe at this area is positive
CIRCLEA circular hit area, any probe at this area is positive
POLYGONAn arbitrary polygonal hit area, any probe at this area is positive