Phaser API Documentation

  Version: 
Filter
Namespace: Scale
Phaser.Scale
Source: src/scale/index.js (Line 10)

Classes

Namespace

Members

<static, constant> CENTER_BOTH: number
Focus
Focus

Description:

The game canvas is centered both horizontally and vertically within the parent. To do this, the parent has to have a bounds that can be calculated and not be empty.

Centering is achieved by setting the margin left and top properties of the game canvas, and does not factor in any other CSS styles you may have applied.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> CENTER_HORIZONTALLY: number
Focus
Focus

Description:

The game canvas is centered horizontally within the parent. To do this, the parent has to have a bounds that can be calculated and not be empty.

Centering is achieved by setting the margin left and top properties of the game canvas, and does not factor in any other CSS styles you may have applied.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> CENTER_VERTICALLY: number
Focus
Focus

Description:

The game canvas is centered both vertically within the parent. To do this, the parent has to have a bounds that can be calculated and not be empty.

Centering is achieved by setting the margin left and top properties of the game canvas, and does not factor in any other CSS styles you may have applied.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> ENVELOP: number
Focus
Focus

Description:

The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> FIT: number
Focus
Focus

Description:

The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> HEIGHT_CONTROLS_WIDTH: number
Focus
Focus

Description:

The width is automatically adjusted based on the height.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> LANDSCAPE: string
Focus
Focus

Description:

A landscape orientation.

Type:
string
Since: 3.16.0
Focus
Focus
<static, constant> MAX_ZOOM: number
Focus
Focus

Description:

Calculate the zoom value based on the maximum multiplied game size that will fit into the parent, or browser window if no parent is set.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> NONE: number
Focus
Focus

Description:

No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need to call the Scale Managers resize method to give the new dimensions, or input events will stop working.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> NO_CENTER: number
Focus
Focus

Description:

The game canvas is not centered within the parent by Phaser. You can still center it yourself via CSS.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> NO_ZOOM: number
Focus
Focus

Description:

The game canvas will not be zoomed by Phaser.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> PORTRAIT: string
Focus
Focus

Description:

A portrait orientation.

Type:
string
Since: 3.16.0
Focus
Focus
<static, constant> RESIZE: number
Focus
Focus

Description:

The Canvas is resized to fit all available parent space, regardless of aspect ratio.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> WIDTH_CONTROLS_HEIGHT: number
Focus
Focus

Description:

The height is automatically adjusted based on the width.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> ZOOM_2X: number
Focus
Focus

Description:

The game canvas will be 2x zoomed by Phaser.

Type:
number
Since: 3.16.0
Focus
Focus
<static, constant> ZOOM_4X: number
Focus
Focus

Description:

The game canvas will be 4x zoomed by Phaser.

Type:
number
Since: 3.16.0
Focus
Focus

Type Definitions

CenterType
Focus
Focus

Description:

Phaser Scale Manager constants for centering the game canvas.

To find out what each mode does please see Phaser.Scale.Center.

Type:
Since: 3.16.0
Focus
Focus
OrientationType
Focus
Focus

Description:

Phaser Scale Manager constants for orientation.

To find out what each mode does please see Phaser.Scale.Orientation.

Type:
Since: 3.16.0
Focus
Focus
ScaleModeType
Focus
Focus

Description:

Phaser Scale Manager constants for the different scale modes available.

To find out what each mode does please see Phaser.Scale.ScaleModes.

Type:
Since: 3.16.0
Focus
Focus
ZoomType
Focus
Focus

Description:

Phaser Scale Manager constants for zoom modes.

To find out what each mode does please see Phaser.Scale.Zoom.

Type:
Since: 3.16.0
Focus
Focus