2017-11-27 13:46:06 +01:00
|
|
|
if (!this.entityLoaded) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.initialized) {
|
|
|
|
|
|
|
|
this.dom = this.entityLoaded.dom;
|
|
|
|
|
2018-04-10 15:48:32 +02:00
|
|
|
R3.Event.Subscribe(
|
|
|
|
R3.Event.WINDOW_RESIZE,
|
2018-03-09 12:29:11 +01:00
|
|
|
function(data) {
|
|
|
|
this.size = data;
|
2018-03-09 12:30:09 +01:00
|
|
|
this.x = this.size.width / 2;
|
|
|
|
this.y = this.size.height / 2;
|
2018-03-09 12:29:11 +01:00
|
|
|
}.bind(this)
|
|
|
|
)
|
|
|
|
|
2018-04-10 15:48:32 +02:00
|
|
|
this.size = R3.Utils.GetWindowSize();
|
2018-03-09 12:26:51 +01:00
|
|
|
|
2018-03-09 12:29:36 +01:00
|
|
|
this.x = this.size.width / 2;
|
|
|
|
this.y = this.size.height / 2;
|
2017-11-27 13:46:06 +01:00
|
|
|
|
|
|
|
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]];
|
|
|
|
|
2018-03-09 12:47:19 +01:00
|
|
|
var sensitivity = 7;
|
2017-11-27 13:46:06 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2018-03-09 12:44:17 +01:00
|
|
|
//if (this.x < 0) {
|
|
|
|
// this.x = 0;
|
|
|
|
//}
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-09 12:44:17 +01:00
|
|
|
//if (this.x > this.size.width) {
|
|
|
|
// this.x = this.size.width;
|
|
|
|
//}
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-09 12:44:17 +01:00
|
|
|
//if (this.y < 0) {
|
|
|
|
// this.y = 0;
|
|
|
|
//}
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-09 12:44:17 +01:00
|
|
|
//if (this.y > this.size.height) {
|
|
|
|
// this.y = this.size.height;
|
|
|
|
//}
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-04-10 15:48:32 +02:00
|
|
|
R3.Event.Emit(
|
|
|
|
R3.Event.MOUSE_MOVE,
|
2017-11-27 13:46:06 +01:00
|
|
|
{
|
|
|
|
event : {
|
|
|
|
offsetX : this.x,
|
|
|
|
offsetY : this.y,
|
|
|
|
target : data.event.target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
//@ sourceURL=touchMove.js
|