Update: CC - Touch Move (c55930et90.js) 406 bytes modified

beta.r3js.org
-=yb4f310 2017-11-18 13:49:24 +01:00
parent a734d7b411
commit a1f47774cb
1 changed files with 32 additions and 2 deletions

View File

@ -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
}
}