Phaser API Documentation

<static> FromPoints(points, [out])


Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds.


name type arguments description
points array

An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public x and y properties) which should be surrounded by the Rectangle.

out Phaser.Geom.Rectangle <optional>

Optional Rectangle to adjust.


The adjusted out Rectangle, or a new Rectangle if none was provided.

Since: 3.0.0