Phaser API Documentation

  Version: 

Member of: Phaser.Structs.Size

envelop([width], [height])

Description:

The current width and height are adjusted so that they fully envelope the given dimensions, while keeping the aspect ratio.

The size may extend further out than the target area if the aspect ratios differ.

If this Size component has a parent set, then the values are clamped so that it never exceeds the parent on the longest axis.

Parameters:

name type arguments description
width number <optional>

The new width of the Size component.

height number <optional>

The new height of the Size component. If not given, it will use the width value.

Returns:
Description:

This Size component instance.

Examples:
Since: 3.16.0
Source: src/structs/Size.js (Line 542)