Fixed the Bring to Top bug and also fixed Group/World.swap when the child was a tail node. Also improved Group.dump significantly. Fixed Phaser.Utils namespace clash too.

This commit is contained in:
Richard Davey
2013-09-10 12:46:14 +01:00
parent 609ea7ec8f
commit 15fe5ed6c8
8 changed files with 182 additions and 26 deletions
-4
View File
@@ -5,10 +5,6 @@
* @module Phaser
*/
Phaser.Utils = {
// Until we have a proper entry-point
}
/**
* A collection of methods for displaying debug information about game objects.
*
+37
View File
@@ -1,5 +1,42 @@
Phaser.Utils = {
/**
* Javascript string pad
* http://www.webtoolkit.info/
* pad = the string to pad it out with (defaults to a space)
* dir = 1 (left), 2 (right), 3 (both)
**/
pad: function (str, len, pad, dir) {
if (typeof(len) == "undefined") { var len = 0; }
if (typeof(pad) == "undefined") { var pad = ' '; }
if (typeof(dir) == "undefined") { var dir = 3; }
if (len + 1 >= str.length)
{
switch (dir)
{
case 1:
str = Array(len + 1 - str.length).join(pad) + str;
break;
case 3:
var right = Math.ceil((padlen = len - str.length) / 2);
var left = padlen - right;
str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
break;
default:
str = str + Array(len + 1 - str.length).join(pad);
break;
}
}
return str;
},
// This is a slightly modified version of jQuery.isPlainObject
isPlainObject: function (obj) {