Undoing previous change - doesn't actually work at all! #1620

This commit is contained in:
photonstorm 2015-02-18 23:32:12 +00:00
parent 4699770520
commit 35b4926eb8
2 changed files with 4 additions and 11 deletions

View file

@ -153,7 +153,6 @@ We've also removed functions and properties from Pixi classes that Phaser doesn'
* If you load an image and provide a key that was already in-use in the Cache, then the old image is now destroyed (via `Cache.removeImage`) and the new image takes its place.
* BitmapText has a new `maxWidth` property that will attempt to wrap the text if it exceeds the width specified.
* Group.cursorIndex is the index of the item the Group cursor points to. This replaces Group._cache[8].
* Stage.visibilityChange now has a second parameter `fromPhaser`. This is set to `true` by the `Stage._onChange` callback. This should mean that when Phaser is listening for `window.onblur` and `window.onfocus` events it will only trigger the visibilityChange if that event was generated by Phaser itself. If it was generated by something else on the page or iframe it should now be ignored (thanks @austinhallock #1620)
### Bug Fixes

View file

@ -233,7 +233,7 @@ Phaser.Stage.prototype.checkVisibility = function () {
var _this = this;
this._onChange = function (event) {
return _this.visibilityChange(event, true);
return _this.visibilityChange(event);
};
// Does browser support it? If not (like in IE9 or old Android) we need to fall back to blur/focus
@ -251,11 +251,11 @@ Phaser.Stage.prototype.checkVisibility = function () {
if (this.game.device.cocoonJSApp)
{
CocoonJS.App.onSuspended.addEventListener(function () {
Phaser.Stage.prototype.visibilityChange.call(_this, {type: "pause"});
Phaser.Stage.prototype.visibilityChange.call(_this, { type: "pause" });
});
CocoonJS.App.onActivated.addEventListener(function () {
Phaser.Stage.prototype.visibilityChange.call(_this, {type: "resume"});
Phaser.Stage.prototype.visibilityChange.call(_this, { type: "resume" });
});
}
@ -266,14 +266,8 @@ Phaser.Stage.prototype.checkVisibility = function () {
*
* @method Phaser.Stage#visibilityChange
* @param {Event} event - Its type will be used to decide whether the game should be paused or not.
* @param {boolean} fromPhaser - Will be set if called by Phaser, will be undefined if not, causing this method to bail out early.
*/
Phaser.Stage.prototype.visibilityChange = function (event, fromPhaser) {
if (typeof fromPhaser === 'undefined' || !fromPhaser)
{
return;
}
Phaser.Stage.prototype.visibilityChange = function (event) {
if (event.type === 'pagehide' || event.type === 'blur' || event.type === 'pageshow' || event.type === 'focus')
{