What problem does it solve?
Phaser games often look stretched, cut off, or misaligned across different browsers, window sizes, and device orientations; this skill helps you reliably scale the canvas and keep it centered so UI and gameplay stay correct.
Core Features & Use Cases
- ScaleManager-driven responsive scaling: Maintains base vs display sizing so the canvas renders consistently while CSS scales it to match the parent.
- Choose the right scale mode: Supports FIT, ENVELOP, RESIZE, EXPAND, and fixed NONE setups depending on whether you want letterboxing, cropping, or 1:1 pixel mapping.
- Centering and dynamic resize support: Auto-centers using
autoCenter, updates bounds on parent/browser changes, and provides resize/orientation/fullscreen events for UI reflow.
- Fullscreen and orientation handling: Includes
startFullscreen/stopFullscreen/toggleFullscreen, orientation change hooks, and iOS/mobile considerations.
Quick Start
Use the ScaleManager with Phaser.Scale.FIT and Phaser.Scale.CENTER_BOTH so your game keeps aspect ratio while staying centered inside your parent element.