Phaser.MSPointer = function (game){ this.game = game; this.input = game.input; this.callbackContext = this.game; this.pointerDownCallback = null ; this.pointerMoveCallback = null ; this.pointerUpCallback = null ; this.capture = true ; this.button = -1; this.event = null ; this.enabled = true ; this._onMSPointerDown = null ; this._onMSPointerMove = null ; this._onMSPointerUp = null ; } ; Phaser.MSPointer.prototype = { start: function (){ if (this._onMSPointerDown !== null ) { return ; } var _this = this; if (this.game.device.mspointer) { this._onMSPointerDown = function (event){ return _this.onPointerDown(event); } ; this._onMSPointerMove = function (event){ return _this.onPointerMove(event); } ; this._onMSPointerUp = function (event){ return _this.onPointerUp(event); } ; var canvas = this.game.canvas; canvas.addEventListener('MSPointerDown', this._onMSPointerDown, false ); canvas.addEventListener('MSPointerMove', this._onMSPointerMove, false ); canvas.addEventListener('MSPointerUp', this._onMSPointerUp, false ); canvas.addEventListener('pointerDown', this._onMSPointerDown, false ); canvas.addEventListener('pointerMove', this._onMSPointerMove, false ); canvas.addEventListener('pointerUp', this._onMSPointerUp, false ); canvas.style["-ms-content-zooming"] = 'none'; canvas.style["-ms-touch-action"] = 'none'; } } , onPointerDown: function (event){ this.event = event; if (this.capture) { event.preventDefault(); } if (this.pointerDownCallback) { this.pointerDownCallback.call(this.callbackContext, event); } if (!this.input.enabled || !this.enabled) { return ; } event.identifier = event.pointerId; if (event.pointerType === 'mouse' || event.pointerType === 4) { this.input.mousePointer.start(event); } else { this.input.startPointer(event); } } , onPointerMove: function (event){ this.event = event; if (this.capture) { event.preventDefault(); } if (this.pointerMoveCallback) { this.pointerMoveCallback.call(this.callbackContext, event); } if (!this.input.enabled || !this.enabled) { return ; } event.identifier = event.pointerId; if (event.pointerType === 'mouse' || event.pointerType === 4) { this.input.mousePointer.move(event); } else { this.input.updatePointer(event); } } , onPointerUp: function (event){ this.event = event; if (this.capture) { event.preventDefault(); } if (this.pointerUpCallback) { this.pointerUpCallback.call(this.callbackContext, event); } if (!this.input.enabled || !this.enabled) { return ; } event.identifier = event.pointerId; if (event.pointerType === 'mouse' || event.pointerType === 4) { this.input.mousePointer.stop(event); } else { this.input.stopPointer(event); } } , stop: function (){ var canvas = this.game.canvas; canvas.removeEventListener('MSPointerDown', this._onMSPointerDown); canvas.removeEventListener('MSPointerMove', this._onMSPointerMove); canvas.removeEventListener('MSPointerUp', this._onMSPointerUp); canvas.removeEventListener('pointerDown', this._onMSPointerDown); canvas.removeEventListener('pointerMove', this._onMSPointerMove); canvas.removeEventListener('pointerUp', this._onMSPointerUp); } } ; Phaser.MSPointer.prototype.constructor = Phaser.MSPointer;