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:
-
-
HitCanvas
parent -
number
width -
number
height
-
- beginHitRegion(hitRegion)
- Parameters:
-
-
HitRegionSpecification
hitRegion
-
- Return type:
string
- clear()
- Return type:
void
- createChild(width, height)
- Parameters:
-
-
number
width -
number
height
-
- Return type:
HitCanvas
- drawRegions(ctx, dx, dy)
- Parameters:
-
-
CanvasRenderingContext2D
ctx -
number
dx -
number
dy
-
- Return type:
void
- getActiveRegion(x, y, property?)
Returns the active region for a given coordinate. Regions are tried in bottom-up order.
- Parameters:
-
-
number
x – -
number
y – -
K
property –
-
- Return type:
undefined | HitRegionSpecification
- Type constraints:
-
-
K extends keyof HitRegionSpecification
-
- getActiveRegions(x, y, property?)
Returns all active regions for a given coordinate.
- Parameters:
-
-
number
x – -
number
y – -
K
property –
-
- Return type:
HitRegionSpecification[]
- Type constraints:
-
-
K extends keyof HitRegionSpecification
-
- getRegionsForProperty(property)
- Parameters:
-
-
K
property
-
- Return type:
HitRegionSpecification[]
- Type constraints:
-
-
K extends keyof HitRegionSpecification
-
- transferTo(ctx, dx, dy, dw, dh)
- Parameters:
-
-
CanvasRenderingContext2D
ctx -
number
dx -
number
dy -
number
dw -
number
dh
-
- Return type:
void