Update: CC - Touch Move (c55930et90.js) 406 bytes modified
parent
a734d7b411
commit
a1f47774cb
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue