Skip to content

Commit cd314cd

Browse files
committed
Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group is has no children.
1 parent eb3d824 commit cd314cd

3 files changed

Lines changed: 14 additions & 21 deletions

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,26 @@ Version 1.1.4 - "Kandor" - In development
4646

4747
New features:
4848

49-
* TBC
49+
* Added a stage.fullScreenScaleMode property to determine scaling when fullscreen (thanks oysterCrusher)
50+
5051

5152
Updates:
5253

5354
* When a Sprite is destroyed any active filters are removed as well.
5455
* Updated Pixi.js so that removing filters now works correctly without breaking the display list.
5556
* Phaser.Canvas.create updated to it can be given an ID as the 3rd parameter.
57+
* Updated display/fullscreen example to reflect new full screen change.
58+
5659

5760
Bug Fixes:
5861

5962
* Cache.getImageKeys returned __missing in the array, now excluded.
6063
* Fixed Group.scale so you can now scale a Group directly.
6164
* Removed World.scale as it was preventing Group.scale from working - you can still scale the world, but you'll need to factor in Input changes yourself.
6265
* Moved 'dirty' flag for Tilemap to a per-layer flag. Fixes #242
66+
* Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group is has no children.
67+
* Switch Camera.setBoundsToWorld to match world.bounds instead of world (thanks cocoademon)
68+
6369

6470
You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md
6571

src/core/Group.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ Phaser.Group.prototype = {
10471047
*/
10481048
iterate: function (key, value, returnType, callback, callbackContext, args) {
10491049

1050-
if (returnType == Phaser.Group.RETURN_TOTAL && this._container.children.length === 0)
1050+
if (returnType === Phaser.Group.RETURN_TOTAL && this._container.children.length === 0)
10511051
{
10521052
return -1;
10531053
}
@@ -1075,7 +1075,7 @@ Phaser.Group.prototype = {
10751075
callback.apply(callbackContext, args);
10761076
}
10771077

1078-
if (returnType == Phaser.Group.RETURN_CHILD)
1078+
if (returnType === Phaser.Group.RETURN_CHILD)
10791079
{
10801080
return currentNode;
10811081
}
@@ -1086,11 +1086,11 @@ Phaser.Group.prototype = {
10861086
while (currentNode != this._container.last._iNext);
10871087
}
10881088

1089-
if (returnType == Phaser.Group.RETURN_TOTAL)
1089+
if (returnType === Phaser.Group.RETURN_TOTAL)
10901090
{
10911091
return total;
10921092
}
1093-
else if (returnType == Phaser.Group.RETURN_CHILD)
1093+
else if (returnType === Phaser.Group.RETURN_CHILD)
10941094
{
10951095
return null;
10961096
}
@@ -1460,28 +1460,26 @@ Phaser.Group.prototype = {
14601460

14611461
/**
14621462
* @name Phaser.Group#total
1463-
* @property {number} total - The total number of children in this Group, regardless of their alive state.
1463+
* @property {number} total - The total number of children in this Group who have a state of exists = true.
14641464
* @readonly
14651465
*/
14661466
Object.defineProperty(Phaser.Group.prototype, "total", {
14671467

14681468
get: function () {
14691469
return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
1470-
// return this._container.children.length;
14711470
}
14721471

14731472
});
14741473

14751474
/**
14761475
* @name Phaser.Group#length
1477-
* @property {number} length - The number of children in this Group.
1476+
* @property {number} length - The total number of children in this Group, regardless of their exists/alive status.
14781477
* @readonly
14791478
*/
14801479
Object.defineProperty(Phaser.Group.prototype, "length", {
14811480

14821481
get: function () {
1483-
return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
1484-
// return this._container.children.length;
1482+
return this._container.children.length;
14851483
}
14861484

14871485
});

src/pixi/display/DisplayObject.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,6 @@ PIXI.DisplayObject.prototype.addFilter = function(data)
374374
//this.filter = true;
375375
// data[0].target = this;
376376

377-
console.log('addFilter');
378-
console.log(data);
379-
380377
// insert a filter block..
381378
// TODO Onject pool thease bad boys..
382379
var start = new PIXI.FilterBlock();
@@ -395,8 +392,6 @@ console.log(data);
395392

396393
start.target = this;
397394

398-
console.log('start', start);
399-
400395
/*
401396
* insert start
402397
*/
@@ -484,13 +479,7 @@ PIXI.DisplayObject.prototype.removeFilter = function(data)
484479
// console.log("YUOIO")
485480
// modify the list..
486481

487-
console.log('DisplayObject removeFilter');
488-
console.log(data);
489-
490482
var startBlock = data.start;
491-
492-
console.log('start', startBlock);
493-
494483
var nextObject = startBlock._iNext;
495484
var previousObject = startBlock._iPrev;
496485

0 commit comments

Comments
 (0)