Wrapped all events that CocoonJS doesn't support in conditional checks to avoid Cocoon Warnings.

This commit is contained in:
photonstorm 2014-05-29 22:23:33 +01:00
parent 8bc1f99e0c
commit 0c675f741f
5 changed files with 33 additions and 13 deletions

View file

@ -61,6 +61,10 @@ Version 2.0.6 - "Jornhill" - -in development-
* Loader.tilemap has renamed the `mapURL` parameter to `url` and `mapData` to `data` to keep it consistent with the other Loader methods.
* Loader.physics has renamed the `dataURL` parameter to `url` and `jsonData` to `data` to keep it consistent with the other Loader methods.
### CocoonJS Specific Updates
* Wrapped all touch, keyboard, mouse and fulscreen events that CocoonJS doesn't support in conditional checks to avoid Warnings.
### New Features
* BitmapData.extract has a new parameter that lets you control if the destination BitmapData is resized before the pixels are copied.

View file

@ -240,17 +240,20 @@ Phaser.ScaleManager = function (game, width, height) {
return _this.checkResize(event);
}, false);
document.addEventListener('webkitfullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
if (!this.game.device.cocoonJS)
{
document.addEventListener('webkitfullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
document.addEventListener('mozfullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
document.addEventListener('mozfullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
document.addEventListener('fullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
document.addEventListener('fullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
}
};

View file

@ -200,6 +200,11 @@ Phaser.Keyboard.prototype = {
*/
start: function () {
if (this.game.device.cocoonJS)
{
return;
}
if (this._onKeyDown !== null)
{
// Avoid setting multiple listeners

View file

@ -190,8 +190,12 @@ Phaser.Mouse.prototype = {
this.game.canvas.addEventListener('mousedown', this._onMouseDown, true);
this.game.canvas.addEventListener('mousemove', this._onMouseMove, true);
this.game.canvas.addEventListener('mouseup', this._onMouseUp, true);
this.game.canvas.addEventListener('mouseover', this._onMouseOver, true);
this.game.canvas.addEventListener('mouseout', this._onMouseOut, true);
if (!this.game.device.cocoonJS)
{
this.game.canvas.addEventListener('mouseover', this._onMouseOver, true);
this.game.canvas.addEventListener('mouseout', this._onMouseOut, true);
}
},

View file

@ -161,9 +161,13 @@ Phaser.Touch.prototype = {
this.game.canvas.addEventListener('touchstart', this._onTouchStart, false);
this.game.canvas.addEventListener('touchmove', this._onTouchMove, false);
this.game.canvas.addEventListener('touchend', this._onTouchEnd, false);
this.game.canvas.addEventListener('touchenter', this._onTouchEnter, false);
this.game.canvas.addEventListener('touchleave', this._onTouchLeave, false);
this.game.canvas.addEventListener('touchcancel', this._onTouchCancel, false);
if (!this.game.device.cocoonJS)
{
this.game.canvas.addEventListener('touchenter', this._onTouchEnter, false);
this.game.canvas.addEventListener('touchleave', this._onTouchLeave, false);
}
}
},