more sens stuff

beta.r3js.org
-=yb4f310 2017-09-29 08:08:41 +02:00
parent af4715084f
commit 084228cc09
1 changed files with 67 additions and 58 deletions

View File

@ -252,18 +252,27 @@ GameLib.System.Input.prototype.onTouchMove = function (event) {
this.sensitivityCounter++; this.sensitivityCounter++;
var id = null;
var t = null;
if (this.sensitivityCounter < this.touchSensitivity) { if (this.sensitivityCounter < this.touchSensitivity) {
/** /**
* ignore this event * ignore this event
*/ */
return; for (t = 0; t < event.changedTouches.length; t++) {
} else { id = event.changedTouches[t].identifier;
this.sensitivityCounter = 0; this.touches[id].pageX = event.changedTouches[t].pageX;
this.touches[id].pageY = event.changedTouches[t].pageY;
} }
for (var t = 0; t < event.changedTouches.length; t++) { } else {
var id = event.changedTouches[t].identifier; this.sensitivityCounter = 0;
for (t = 0; t < event.changedTouches.length; t++) {
id = event.changedTouches[t].identifier;
var left = 0; var left = 0;
var right = 0; var right = 0;
@ -271,7 +280,7 @@ GameLib.System.Input.prototype.onTouchMove = function (event) {
var down = 0; var down = 0;
if (event.changedTouches[t].pageX > this.touches[id].pageX) { if (event.changedTouches[t].pageX > this.touches[id].pageX) {
right = 1; right += (event.changedTouches[t].pageX - this.touches[id].pageX);
if (this.touches[id].left > 0) { if (this.touches[id].left > 0) {
this.touches[id].left = 0; this.touches[id].left = 0;
this.sensitivityCounter = this.touchSensitivity; this.sensitivityCounter = this.touchSensitivity;
@ -279,7 +288,7 @@ GameLib.System.Input.prototype.onTouchMove = function (event) {
} }
if (event.changedTouches[t].pageX < this.touches[id].pageX) { if (event.changedTouches[t].pageX < this.touches[id].pageX) {
left = 1; left += (this.touches[id].pageX - event.changedTouches[t].pageX);
if (this.touches[id].right > 0) { if (this.touches[id].right > 0) {
this.touches[id].right = 0; this.touches[id].right = 0;
this.sensitivityCounter = this.touchSensitivity; this.sensitivityCounter = this.touchSensitivity;
@ -287,7 +296,7 @@ GameLib.System.Input.prototype.onTouchMove = function (event) {
} }
if (event.changedTouches[t].pageY < this.touches[id].pageY) { if (event.changedTouches[t].pageY < this.touches[id].pageY) {
up = 1; up += (this.touches[id].pageY - event.changedTouches[t].pageY);
if (this.touches[id].down > 0) { if (this.touches[id].down > 0) {
this.touches[id].down = 0; this.touches[id].down = 0;
this.sensitivityCounter = this.touchSensitivity; this.sensitivityCounter = this.touchSensitivity;
@ -295,7 +304,7 @@ GameLib.System.Input.prototype.onTouchMove = function (event) {
} }
if (event.changedTouches[t].pageY > this.touches[id].pageY) { if (event.changedTouches[t].pageY > this.touches[id].pageY) {
down = 1; down += (event.changedTouches[t].pageY - this.touches[id].pageY);
if (this.touches[id].up > 0) { if (this.touches[id].up > 0) {
this.touches[id].up = 0; this.touches[id].up = 0;
this.sensitivityCounter = this.touchSensitivity; this.sensitivityCounter = this.touchSensitivity;
@ -316,7 +325,7 @@ GameLib.System.Input.prototype.onTouchMove = function (event) {
GameLib.Event.TOUCH_MOVE, GameLib.Event.TOUCH_MOVE,
this.touches this.touches
); );
}
}; };
GameLib.System.Input.prototype.onTouchCancel = function(event) { GameLib.System.Input.prototype.onTouchCancel = function(event) {