class
HitCanvas
Keeps track of regions of interest (hit regions).
Hit regions are registered during the draw loop of the main visible canvas. A sticky identifier should be used to mark regions as meaning the same between different draws.
- Properties
- ctx
- Methods
- constructor, beginHitRegion, clear, createChild, drawRegions, getActiveRegion, getActiveRegions, getRegionsForProperty, transferTo
Properties
Methods
- constructor(parent?, width?, height?)
- Parameters:
-
-
HitCanvasparent -
numberwidth -
numberheight
-
- beginHitRegion(hitRegion)
- Parameters:
-
-
HitRegionSpecificationhitRegion
-
- Return type:
string
- clear()
- Return type:
void
- createChild(width, height)
- Parameters:
-
-
numberwidth -
numberheight
-
- Return type:
HitCanvas
- drawRegions(ctx, dx, dy)
- Parameters:
-
-
CanvasRenderingContext2Dctx -
numberdx -
numberdy
-
- Return type:
void
- getActiveRegion(x, y, property?)
Returns the active region for a given coordinate. Regions are tried in bottom-up order.
- Parameters:
-
-
numberx – -
numbery – -
Kproperty –
-
- Return type:
undefined | HitRegionSpecification- Type constraints:
-
-
K extends keyof HitRegionSpecification
-
- getActiveRegions(x, y, property?)
Returns all active regions for a given coordinate.
- Parameters:
-
-
numberx – -
numbery – -
Kproperty –
-
- Return type:
HitRegionSpecification[]- Type constraints:
-
-
K extends keyof HitRegionSpecification
-
- getRegionsForProperty(property)
- Parameters:
-
-
Kproperty
-
- Return type:
HitRegionSpecification[]- Type constraints:
-
-
K extends keyof HitRegionSpecification
-
- transferTo(ctx, dx, dy, dw, dh)
- Parameters:
-
-
CanvasRenderingContext2Dctx -
numberdx -
numberdy -
numberdw -
numberdh
-
- Return type:
void