Phaser API Documentation

  Version: 
<static> FitInside(target, source)

Description:

Adjusts the target rectangle, changing its width, height and position, so that it fits inside the area of the source rectangle, while maintaining its original aspect ratio.

Unlike the FitOutside function, there may be some space inside the source area not covered.

Parameters:

name type description
target Phaser.Geom.Rectangle

The target rectangle to adjust.

source Phaser.Geom.Rectangle

The source rectangle to envelop the target in.

Returns:
Description:

The modified target rectangle instance.

Since: 3.0.0