Debug.cameraInfo no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)

Camera.setBoundsToWorld no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
This commit is contained in:
photonstorm 2014-08-28 02:13:51 +01:00
parent 01db9257e0
commit d7f8950758
4 changed files with 13 additions and 2 deletions

1
.gitignore vendored
View file

@ -15,3 +15,4 @@ node_modules/
# Build
dist/
/npm-debug.log

View file

@ -107,6 +107,8 @@ Version 2.1.0 - "Cairhien" - -in development-
* Swapped argument order of Rectangle.containsRect (thanks @beeglebug #1095 #1125)
* The Game configuration object "renderer" property was being wrongly assigned to Game.renderer instead of renderType (thanks @FedeOmoto #1127)
* Fixed Group.removeBetweens default endIndex (thanks @darfux #1142)
* Debug.cameraInfo no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
* Camera.setBoundsToWorld no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
### p2.js 0.6.0 Changes and New Features

View file

@ -274,7 +274,10 @@ Phaser.Camera.prototype = {
*/
setBoundsToWorld: function () {
this.bounds.setTo(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
if (this.bounds)
{
this.bounds.setTo(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
}
},

View file

@ -267,7 +267,12 @@ Phaser.Utils.Debug.prototype = {
this.start(x, y, color);
this.line('Camera (' + camera.width + ' x ' + camera.height + ')');
this.line('X: ' + camera.x + ' Y: ' + camera.y);
this.line('Bounds x: ' + camera.bounds.x + ' Y: ' + camera.bounds.y + ' w: ' + camera.bounds.width + ' h: ' + camera.bounds.height);
if (camera.bounds)
{
this.line('Bounds x: ' + camera.bounds.x + ' Y: ' + camera.bounds.y + ' w: ' + camera.bounds.width + ' h: ' + camera.bounds.height);
}
this.line('View x: ' + camera.view.x + ' Y: ' + camera.view.y + ' w: ' + camera.view.width + ' h: ' + camera.view.height);
this.stop();