PR pixi-reels

RectMaskStrategy

pixi-reels


pixi-reels / index / RectMaskStrategy

Class: RectMaskStrategy

Defined in: core/ReelViewport.ts:57

v1 default: a per-reel rectangular mask. Each reel is clipped to its own (offsetY, reelHeight) box so pyramid shapes clip cleanly without buffer-row 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 horizontal symbolGap.x > 0, a symbol that extends across the gap (e.g. a 2×2 bonus on a non-zero-gap layout) will be clipped between the columns. Use SharedRectMaskStrategy in that case, or set symbolGap: { x: 0, y: ... }.

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

Methods

build()

build(
   rects: ReelMaskRect[], 
   totalWidth: number, 
   totalHeight: number): Graphics;

Defined in: core/ReelViewport.ts:58

Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask.

Parameters

ParameterType
rectsReelMaskRect[]
totalWidthnumber
totalHeightnumber

Returns

Graphics

Implementation of

MaskStrategy.build


update()

update(
   g: Graphics, 
   rects: ReelMaskRect[], 
   totalWidth: number, 
   totalHeight: number): void;

Defined in: core/ReelViewport.ts:64

Update the mask when reel boxes resize (e.g. MultiWays reshape).

Parameters

ParameterType
gGraphics
rectsReelMaskRect[]
totalWidthnumber
totalHeightnumber

Returns

void

Implementation of

MaskStrategy.update