-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
Scale.js
31 lines (27 loc) · 1.03 KB
/
Scale.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013-2023 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Scales the width and height of this Rectangle by the given amounts.
*
* @function Phaser.Geom.Rectangle.Scale
* @since 3.0.0
*
* @generic {Phaser.Geom.Rectangle} O - [rect,$return]
*
* @param {Phaser.Geom.Rectangle} rect - The `Rectangle` object that will be scaled by the specified amount(s).
* @param {number} x - The factor by which to scale the rectangle horizontally.
* @param {number} y - The amount by which to scale the rectangle vertically. If this is not specified, the rectangle will be scaled by the factor `x` in both directions.
*
* @return {Phaser.Geom.Rectangle} The rectangle object with updated `width` and `height` properties as calculated from the scaling factor(s).
*/
var Scale = function (rect, x, y)
{
if (y === undefined) { y = x; }
rect.width *= x;
rect.height *= y;
return rect;
};
module.exports = Scale;