Phaser API Documentation

  Version: 
getBounds([output])

Description:

Gets the bounds of this Container. It works by iterating all children of the Container, getting their respective bounds, and then working out a min-max rectangle from that. It does not factor in if the children render or not, all are included.

Some children are unable to return their bounds, such as Graphics objects, in which case they are skipped.

Depending on the quantity of children in this Container it could be a really expensive call, so cache it and only poll it as needed.

The values are stored and returned in a Rectangle object.

Parameters:

name type arguments description
output Phaser.Geom.Rectangle <optional>

A Geom.Rectangle object to store the values in. If not provided a new Rectangle will be created.

Returns:
Description:

The values stored in the output object.

Since: 3.4.0