Skip to content

Add native touch gestures support with UltraVNC #1908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix touches with same id not being removed properly
  • Loading branch information
Rui Reis committed Jul 31, 2024
commit 6b770c9da26e47454416e5d49a16e2365c8d9f23
14 changes: 10 additions & 4 deletions core/input/touchhandlerultravnc.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,20 @@ export default class TouchHandlerUltraVNC {
}
} else if (ev.type === "touchend" || ev.type === "touchcancel") {
for (let i = 0; i < ev.changedTouches.length; i++) {
const index = this._currentTouches.findIndex(t => t.event.identifier === ev.changedTouches[i].identifier);
if (index !== -1) {
this._currentTouches[index].status = "POINTER_UP";
}
const indexes = this._getAllIndexes(this._currentTouches, (t) => t.event.identifier === ev.changedTouches[i].identifier)
indexes.forEach((index) => 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) {
let tev = new CustomEvent('ultravnctouch', { event: ev, detail: { currentTouches: this._currentTouches, giiDeviceOrigin: this._giiDeviceOrigin } });
this._target.dispatchEvent(tev);
Expand Down