r3-custom-code/c55930et90.js

46 lines
772 B
JavaScript

var touch = data[Object.keys(data)[0]];
console.log(data);
if (!this.initialized) {
this.x = window.innerWidth / 2;
this.y = window.innerHeight / 2;
this.initialized = true;
}
var sensitivity = 1;
this.x -= Math.round(touch.left * sensitivity);
this.x += Math.round(touch.right * sensitivity);
this.y -= Math.round(touch.up * sensitivity);
this.y += Math.round(touch.down * sensitivity);
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 : this.x,
offsetY : this.y,
target : data.event.target
}
}
)
//@ sourceURL=touchMove.js