Fix touches with same id not being removed properly
This commit is contained in:
parent
c1efe1f987
commit
6b770c9da2
|
@ -88,12 +88,18 @@ export default class TouchHandlerUltraVNC {
|
||||||
}
|
}
|
||||||
} else if (ev.type === "touchend" || ev.type === "touchcancel") {
|
} else if (ev.type === "touchend" || ev.type === "touchcancel") {
|
||||||
for (let i = 0; i < ev.changedTouches.length; i++) {
|
for (let i = 0; i < ev.changedTouches.length; i++) {
|
||||||
const index = this._currentTouches.findIndex(t => t.event.identifier === ev.changedTouches[i].identifier);
|
const indexes = this._getAllIndexes(this._currentTouches, (t) => t.event.identifier === ev.changedTouches[i].identifier)
|
||||||
if (index !== -1) {
|
indexes.forEach((index) => this._currentTouches[index].status = "POINTER_UP");
|
||||||
this._currentTouches[index].status = "POINTER_UP";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getAllIndexes(arr, func) {
|
||||||
|
var indexes = [], i;
|
||||||
|
for (i = 0; i < arr.length; i++)
|
||||||
|
if (func(arr[i]))
|
||||||
|
indexes.push(i);
|
||||||
|
return indexes;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dispatchTouchEvent(ev) {
|
_dispatchTouchEvent(ev) {
|
||||||
|
|
Loading…
Reference in New Issue