Skip to content

Commit 5a1cb00

Browse files
committed
beautified
1 parent 5b4b41c commit 5a1cb00

1 file changed

Lines changed: 60 additions & 57 deletions

File tree

src/core/Group.js

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* In addition, Groups provides support for fast pooling and object recycling.
1414
*
1515
* Groups are also display objects and can be nested as children within other Groups.
16-
*
16+
*
1717
* @class Phaser.Group
1818
* @extends PIXI.DisplayObjectContainer
1919
* @param {Phaser.Game} game - A reference to the currently running game.
@@ -107,13 +107,13 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
107107
this.ignoreDestroy = false;
108108

109109
/**
110-
* A Group is that has `pendingDestroy` set to `true` is flagged to have its destroy method
110+
* A Group is that has `pendingDestroy` set to `true` is flagged to have its destroy method
111111
* called on the next logic update.
112112
* You can set it directly to flag the Group to be destroyed on its next update.
113-
*
114-
* This is extremely useful if you wish to destroy a Group from within one of its own callbacks
113+
*
114+
* This is extremely useful if you wish to destroy a Group from within one of its own callbacks
115115
* or a callback of one of its children.
116-
*
116+
*
117117
* @property {boolean} pendingDestroy
118118
*/
119119
this.pendingDestroy = false;
@@ -164,7 +164,7 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
164164

165165
/**
166166
* If this Group contains Arcade Physics Sprites you can set a custom sort direction via this property.
167-
*
167+
*
168168
* It should be set to one of the Phaser.Physics.Arcade sort direction constants:
169169
*
170170
* Phaser.Physics.Arcade.SORT_NONE
@@ -1976,57 +1976,60 @@ Phaser.Group.prototype.getBottom = function () {
19761976
};
19771977

19781978
/**
1979-
* Get the closest child to given Object/Point/Sprite/Image
1980-
*
1981-
* @method Phaser.Group#getClosestTo
1982-
* @return {any} The child closest to given Object/Point/Sprite/Image
1983-
*/
1984-
Phaser.Group.prototype.getClosestTo = function (object) {
1985-
1986-
if (this.children.length !== 0) {
1987-
var distance = Number.MAX_VALUE,
1988-
tempDistance = 0,
1989-
returnee;
1990-
this.forEachAlive(function(e) {
1991-
1992-
tempDistance = Math.abs(Phaser.Point.distance(object, e));
1993-
1994-
if (tempDistance < distance) {
1995-
distance = tempDistance;
1996-
returnee = e;
1997-
}
1998-
});
1999-
2000-
if (returnee) return returnee;
2001-
}
2002-
2003-
};
2004-
2005-
/**
2006-
* Get the farthest child to given Object/Point/Sprite/Image
2007-
*
2008-
* @method Phaser.Group#getFarthestFrom
2009-
* @return {any} The child farthest from given Object/Point/Sprite/Image
2010-
*/
2011-
Phaser.Group.prototype.getFarthestFrom = function (object) {
2012-
2013-
if (this.children.length !== 0) {
2014-
var distance = 0,
2015-
tempDistance = 0,
2016-
returnee;
2017-
this.forEachAlive(function(e) {
2018-
2019-
tempDistance = Math.abs(Phaser.Point.distance(object, e));
2020-
2021-
if (tempDistance > distance) {
2022-
distance = tempDistance;
2023-
returnee = e;
2024-
}
2025-
});
2026-
2027-
if (returnee) return returnee;
2028-
}
2029-
1979+
* Get the closest child to given Object/Point/Sprite/Image
1980+
*
1981+
* @method Phaser.Group#getClosestTo
1982+
* @return {any} The child closest to given Object/Point/Sprite/Image
1983+
*/
1984+
Phaser.Group.prototype.getClosestTo = function(object) {
1985+
1986+
if (this.children.length !== 0) {
1987+
var distance = Number.MAX_VALUE,
1988+
tempDistance = 0,
1989+
returnee;
1990+
this.forEachAlive(function(e) {
1991+
1992+
tempDistance = Math.abs(Phaser.Point.distance(object, e));
1993+
1994+
if (tempDistance < distance) {
1995+
distance = tempDistance;
1996+
returnee = e;
1997+
}
1998+
});
1999+
2000+
if (returnee) {
2001+
return returnee
2002+
};
2003+
}
2004+
2005+
};
2006+
2007+
/**
2008+
* Get the farthest child from given Object/Point/Sprite/Image
2009+
*
2010+
* @method Phaser.Group#getFarthestFrom
2011+
* @return {any} The child farthest from given Object/Point/Sprite/Image
2012+
*/
2013+
Phaser.Group.prototype.getFarthestFrom = function(object) {
2014+
2015+
if (this.children.length !== 0) {
2016+
var distance = 0,
2017+
tempDistance = 0,
2018+
returnee;
2019+
this.forEachAlive(function(e) {
2020+
2021+
tempDistance = Math.abs(Phaser.Point.distance(object, e));
2022+
2023+
if (tempDistance > distance) {
2024+
distance = tempDistance;
2025+
returnee = e;
2026+
}
2027+
});
2028+
if (returnee) {
2029+
return returnee
2030+
};
2031+
}
2032+
20302033
};
20312034

20322035
/**

0 commit comments

Comments
 (0)