RectMaskStrategy
pixi-reels / index / RectMaskStrategy
Class: RectMaskStrategy
Defined in: core/ReelViewport.ts:125
v1 default: a per-reel rectangular mask. Each reel is clipped to its own
(mainOffset, extent) box so pyramid shapes clip cleanly without
buffer-cell peek above or below short reels.
PixiJS masks support multiple shapes inside a single Graphics. the union of every filled shape is the visible region. So drawing one rect per reel gives the engine a jagged-but-rectangular mask without a custom shader.
Caveat: if reels have a non-zero CROSS-axis gap (symbolGap.x on a
vertical set, symbolGap.y on a horizontal one), a symbol that extends
across the gap (e.g. a 2x2 bonus) will be clipped between the reels. Use
SharedRectMaskStrategy in that case, or drop the cross gap to 0.
If rects is empty (the builder hasn’t supplied per-reel rects yet),
this falls back to a single bounding-box rect.
Implements#
Constructors#
Constructor#
new RectMaskStrategy(): RectMaskStrategy;
Returns#
RectMaskStrategy
Properties#
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
version | readonly | 2 | MASK_STRATEGY_VERSION | Must equal MASK_STRATEGY_VERSION. Validated by ReelSetBuilder.maskStrategy(). | core/ReelViewport.ts:126 |
Methods#
build()#
build(ctx: MaskContext): Graphics;
Defined in: core/ReelViewport.ts:128
Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask.
Parameters#
| Parameter | Type |
|---|---|
ctx | MaskContext |
Returns#
Graphics
Implementation of#
draw()#
draw(g: Graphics, ctx: MaskContext): void;
Defined in: core/ReelViewport.ts:143
Draw into a Graphics somebody else owns, so this strategy can be combined
by composeMasks(...) / inset(...). Does not clear.
Parameters#
| Parameter | Type |
|---|---|
g | Graphics |
ctx | MaskContext |
Returns#
void
update()#
update(g: Graphics, ctx: MaskContext): void;
Defined in: core/ReelViewport.ts:134
Update the mask when reel boxes resize (e.g. MultiWays reshape).
Parameters#
| Parameter | Type |
|---|---|
g | Graphics |
ctx | MaskContext |
Returns#
void