Initial Commit: CC - Touch Move (cnn8o15h2g.js)

beta.r3js.org
-=yb4f310 2017-11-25 16:05:07 +01:00
parent fd8126f7ff
commit b36571a901
1 changed files with 68 additions and 0 deletions

68
cnn8o15h2g.js Normal file
View File

@ -0,0 +1,68 @@
if (!this.entityLoaded) {
return;
}
if (!this.initialized) {
this.dom = this.entityLoaded.dom;
this.x = window.innerWidth / 2;
this.y = window.innerHeight / 2;
this.initialized = true;
}
if (data.meta.zoom || data.meta.outward) {
/* if (!this.dom.fullscreen && !this.requested) {
console.log('requesting fullscreen');
this.dom.requestFullscreen();
this.requested = true;
}*/
/*
*/
//if (data.meta.pinch || data.meta.inward) {
// if (this.dom.fullscreen) {
// this.dom.exitFullscreen();
// }
//}
}
var touch = data[Object.keys(data)[0]];
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