diff --git a/c55930et90.js b/c55930et90.js index d8a216d..4024772 100644 --- a/c55930et90.js +++ b/c55930et90.js @@ -2,12 +2,42 @@ var touch = data[Object.keys(data)[0]]; console.log(touch); +if (!this.initialized) { + + this.x = window.innerWidth / 2; + this.y = window.innerHeight / 2; + + this.initialized = true; +} + +this.x -= touch.left; +this.x += touch.right; + +this.y -= touch.down; +this.y += touch.up; + +if (this.x < 0) { + this.x = 0; +} + +if (this.x > window.innerWidth) { + this.x = window.innerWidth; +} + +if (this.y < 0) { + this.y = 0; +} + +if (this.y > window.innerHeight) { + this.y = window.innerHeight; +} + GameLib.Event.Emit( GameLib.Event.MOUSE_MOVE, { event : { - offsetX : touch.pageX, - offsetY : touch.pageY, + offsetX : this.x, + offsetY : this.y, target : data.event.target } }