r3-custom-code/evwkow5289.js

79 lines
1.3 KiB
JavaScript

if (!this.entityLoaded) {
return;
}
if (!this.initialized) {
this.dom = this.entityLoaded.dom;
R3.Event.Subscribe(
R3.Event.WINDOW_RESIZE,
function(data) {
this.size = data;
this.x = this.size.width / 2;
this.y = this.size.height / 2;
}.bind(this)
)
this.size = R3.Utils.GetWindowSize();
this.x = this.size.width / 2;
this.y = this.size.height / 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 = 7;
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 > this.size.width) {
// this.x = this.size.width;
//}
//if (this.y < 0) {
// this.y = 0;
//}
//if (this.y > this.size.height) {
// this.y = this.size.height;
//}
R3.Event.Emit(
R3.Event.MOUSE_MOVE,
{
event : {
offsetX : this.x,
offsetY : this.y,
target : data.event.target
}
}
)
//@ sourceURL=touchMove.js