Phaser API Documentation


Member of: Phaser.Structs.Size

envelop([width], [height])


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.


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.


This Size component instance.

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