Skip to content

Commit c2f78fe

Browse files
committed
Determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality.
1 parent e36356e commit c2f78fe

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2018 Photon Storm Ltd.
4+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
5+
*/
6+
7+
/**
8+
* Determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality.
9+
*
10+
* @function Phaser.Geom.Rectangle.SameDimensions
11+
* @since 3.15.0
12+
*
13+
* @param {Phaser.Geom.Rectangle} rect - The first Rectangle object.
14+
* @param {Phaser.Geom.Rectangle} toCompare - The second Rectangle object.
15+
*
16+
* @return {boolean} `true` if the objects have equivalent values for the `width` and `height` properties, otherwise `false`.
17+
*/
18+
var SameDimensions = function (rect, toCompare)
19+
{
20+
return (rect.width === toCompare.width && rect.height === toCompare.height);
21+
};
22+
23+
module.exports = SameDimensions;

src/geom/rectangle/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Rectangle.Perimeter = require('./Perimeter');
4040
Rectangle.PerimeterPoint = require('./PerimeterPoint');
4141
Rectangle.Random = require('./Random');
4242
Rectangle.RandomOutside = require('./RandomOutside');
43+
Rectangle.SameDimensions = require('./SameDimensions');
4344
Rectangle.Scale = require('./Scale');
4445
Rectangle.Union = require('./Union');
4546

0 commit comments

Comments
 (0)