reset sensitivity counter
parent
3515b406d5
commit
79f595342b
|
@ -248,11 +248,15 @@ GameLib.System.Input.prototype.onTouchMove = function(touchControl) {
|
|||
this.sensitivityCounter++;
|
||||
|
||||
if (this.sensitivityCounter < touchControl.sensitivity) {
|
||||
|
||||
console.log(this.sensitivityCounter);
|
||||
|
||||
return;
|
||||
} else {
|
||||
this.sensitivityCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
for (var t = 0; t < event.changedTouches.length; t++) {
|
||||
|
||||
var id = event.changedTouches[t].identifier;
|
||||
|
@ -264,22 +268,18 @@ GameLib.System.Input.prototype.onTouchMove = function(touchControl) {
|
|||
|
||||
if (event.changedTouches[t].pageX > this.touches[id].pageX) {
|
||||
right = 1;
|
||||
left = -1;
|
||||
}
|
||||
|
||||
if (event.changedTouches[t].pageX < this.touches[id].pageX) {
|
||||
left = 1;
|
||||
right = -1;
|
||||
}
|
||||
|
||||
if (event.changedTouches[t].pageY < this.touches[id].pageY) {
|
||||
up = 1;
|
||||
down = -1;
|
||||
}
|
||||
|
||||
if (event.changedTouches[t].pageY > this.touches[id].pageY) {
|
||||
down = 1;
|
||||
up = -1;
|
||||
}
|
||||
|
||||
this.touches[id].right += right;
|
||||
|
@ -302,6 +302,9 @@ GameLib.System.Input.prototype.onTouchMove = function(touchControl) {
|
|||
};
|
||||
|
||||
GameLib.System.Input.prototype.onTouchCancel = function(event) {
|
||||
|
||||
this.sensitivityCounter = 0;
|
||||
|
||||
for (var t = 0; t < event.changedTouches.length; t++) {
|
||||
this.touches[event.changedTouches[t].identifier].cancelled = true;
|
||||
this.touches[event.changedTouches[t].identifier].event = event;
|
||||
|
@ -314,6 +317,9 @@ GameLib.System.Input.prototype.onTouchCancel = function(event) {
|
|||
};
|
||||
|
||||
GameLib.System.Input.prototype.onTouchEnd = function(event) {
|
||||
|
||||
this.sensitivityCounter = 0;
|
||||
|
||||
for (var t = 0; t < event.changedTouches.length; t++) {
|
||||
this.touches[event.changedTouches[t].identifier].ended = true;
|
||||
this.touches[event.changedTouches[t].identifier].event = event;
|
||||
|
|
Loading…
Reference in New Issue