more sens stuff
parent
af4715084f
commit
084228cc09
|
@ -252,71 +252,80 @@ 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++) {
|
||||||
|
id = event.changedTouches[t].identifier;
|
||||||
|
this.touches[id].pageX = event.changedTouches[t].pageX;
|
||||||
|
this.touches[id].pageY = event.changedTouches[t].pageY;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.sensitivityCounter = 0;
|
this.sensitivityCounter = 0;
|
||||||
|
|
||||||
|
|
||||||
|
for (t = 0; t < event.changedTouches.length; t++) {
|
||||||
|
|
||||||
|
id = event.changedTouches[t].identifier;
|
||||||
|
|
||||||
|
var left = 0;
|
||||||
|
var right = 0;
|
||||||
|
var up = 0;
|
||||||
|
var down = 0;
|
||||||
|
|
||||||
|
if (event.changedTouches[t].pageX > this.touches[id].pageX) {
|
||||||
|
right += (event.changedTouches[t].pageX - this.touches[id].pageX);
|
||||||
|
if (this.touches[id].left > 0) {
|
||||||
|
this.touches[id].left = 0;
|
||||||
|
this.sensitivityCounter = this.touchSensitivity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.changedTouches[t].pageX < this.touches[id].pageX) {
|
||||||
|
left += (this.touches[id].pageX - event.changedTouches[t].pageX);
|
||||||
|
if (this.touches[id].right > 0) {
|
||||||
|
this.touches[id].right = 0;
|
||||||
|
this.sensitivityCounter = this.touchSensitivity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.changedTouches[t].pageY < this.touches[id].pageY) {
|
||||||
|
up += (this.touches[id].pageY - event.changedTouches[t].pageY);
|
||||||
|
if (this.touches[id].down > 0) {
|
||||||
|
this.touches[id].down = 0;
|
||||||
|
this.sensitivityCounter = this.touchSensitivity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.changedTouches[t].pageY > this.touches[id].pageY) {
|
||||||
|
down += (event.changedTouches[t].pageY - this.touches[id].pageY);
|
||||||
|
if (this.touches[id].up > 0) {
|
||||||
|
this.touches[id].up = 0;
|
||||||
|
this.sensitivityCounter = this.touchSensitivity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.touches[id].right += right;
|
||||||
|
this.touches[id].left += left;
|
||||||
|
this.touches[id].up += up;
|
||||||
|
this.touches[id].down += down;
|
||||||
|
this.touches[id].pageX = event.changedTouches[t].pageX;
|
||||||
|
this.touches[id].pageY = event.changedTouches[t].pageY;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.touches.event = event;
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.TOUCH_MOVE,
|
||||||
|
this.touches
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var t = 0; t < event.changedTouches.length; t++) {
|
|
||||||
|
|
||||||
var id = event.changedTouches[t].identifier;
|
|
||||||
|
|
||||||
var left = 0;
|
|
||||||
var right = 0;
|
|
||||||
var up = 0;
|
|
||||||
var down = 0;
|
|
||||||
|
|
||||||
if (event.changedTouches[t].pageX > this.touches[id].pageX) {
|
|
||||||
right = 1;
|
|
||||||
if (this.touches[id].left > 0) {
|
|
||||||
this.touches[id].left = 0;
|
|
||||||
this.sensitivityCounter = this.touchSensitivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.changedTouches[t].pageX < this.touches[id].pageX) {
|
|
||||||
left = 1;
|
|
||||||
if (this.touches[id].right > 0) {
|
|
||||||
this.touches[id].right = 0;
|
|
||||||
this.sensitivityCounter = this.touchSensitivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.changedTouches[t].pageY < this.touches[id].pageY) {
|
|
||||||
up = 1;
|
|
||||||
if (this.touches[id].down > 0) {
|
|
||||||
this.touches[id].down = 0;
|
|
||||||
this.sensitivityCounter = this.touchSensitivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.changedTouches[t].pageY > this.touches[id].pageY) {
|
|
||||||
down = 1;
|
|
||||||
if (this.touches[id].up > 0) {
|
|
||||||
this.touches[id].up = 0;
|
|
||||||
this.sensitivityCounter = this.touchSensitivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.touches[id].right += right;
|
|
||||||
this.touches[id].left += left;
|
|
||||||
this.touches[id].up += up;
|
|
||||||
this.touches[id].down += down;
|
|
||||||
this.touches[id].pageX = event.changedTouches[t].pageX;
|
|
||||||
this.touches[id].pageY = event.changedTouches[t].pageY;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.touches.event = event;
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.TOUCH_MOVE,
|
|
||||||
this.touches
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Input.prototype.onTouchCancel = function(event) {
|
GameLib.System.Input.prototype.onTouchCancel = function(event) {
|
||||||
|
|
Loading…
Reference in New Issue