UNPKG

arcade-physics

Version:
34 lines 1.17 kB
"use strict"; /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Point_1 = __importDefault(require("../point/Point")); /** * Returns the center of a Rectangle as a Point. * * @function Phaser.Geom.Rectangle.GetCenter * @since 3.0.0 * * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the center of. * @param {(Phaser.Geom.Point|object)} [out] - Optional point-like object to update with the center coordinates. * * @return {(Phaser.Geom.Point|object)} The modified `out` object, or a new Point if none was provided. */ const GetCenter = (rect, out) => { if (out === undefined) { out = new Point_1.default(); } out.x = rect.centerX; out.y = rect.centerY; return out; }; exports.default = GetCenter; //# sourceMappingURL=GetCenter.js.map