Skip to content

Commit 3ebd0d9

Browse files
committed
Updated Device.isConsoleOpen as it no longer works in Chrome. Revised code and documentation accordingly (fix phaserjs#593)
Revised p2 clear process.
1 parent 96296c6 commit 3ebd0d9

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Bug Fixes
6767
* Removed the examples build script from the Gruntfile (fix #592)
6868
* The P2 World wouldn't clear down fully on a State change, now properly clears out contacts, resets the bitmask, etc.
6969

70+
Updated:
71+
72+
* Updated Device.isConsoleOpen as it no longer works in Chrome. Revised code and documentation accordingly (fix #593)
73+
7074

7175
TODO:
7276

src/physics/p2/World.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ Phaser.Physics.P2.prototype = {
651651
},
652652

653653
/**
654-
* Clears all bodies from the simulation.
654+
* Clears all bodies from the simulation, resets callbacks and resets the collision bitmask.
655655
*
656656
* @method Phaser.Physics.P2#clear
657657
*/
@@ -662,13 +662,13 @@ Phaser.Physics.P2.prototype = {
662662
this.world.off("beginContact", this.beginContactHandler, this);
663663
this.world.off("endContact", this.endContactHandler, this);
664664

665+
this.setPostBroadphaseCallback(null);
666+
this.setImpactEvents(null);
667+
665668
this.collisionGroups = [];
666669
this._toRemove = [];
667-
this.boundsCollidesWith = [];
668670
this._collisionGroupID = 2;
669-
this.postBroadphaseCallback = null;
670-
this.callbackContext = null;
671-
this.impactCallback = null;
671+
this.boundsCollidesWith = [];
672672

673673
},
674674

src/system/Device.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,9 @@ Phaser.Device.prototype = {
753753

754754
/**
755755
* Check whether the console is open.
756+
* Note that this only works in Firefox with Firebug and earlier versions of Chrome.
757+
* It used to work in Chrome, but then they removed the ability: http://src.chromium.org/viewvc/blink?view=revision&revision=151136
758+
*
756759
* @method Phaser.Device#isConsoleOpen
757760
* @return {boolean} True if the browser dev console is open.
758761
*/
@@ -773,7 +776,10 @@ Phaser.Device.prototype = {
773776
console.clear();
774777
}
775778

776-
return console['profiles'].length > 0;
779+
if (console['profiles'])
780+
{
781+
return console['profiles'].length > 0;
782+
}
777783
}
778784

779785
return false;

0 commit comments

Comments
 (0)