add interpolation to cursor reticles

cursor reticles are now interpolated to the update interval, so they should be smooth at > 60 fps
This commit is contained in:
りき萌 2025-06-26 18:48:16 +02:00
parent bebc2daa95
commit a40480a464
3 changed files with 81 additions and 19 deletions

View file

@ -26,6 +26,7 @@ let connectionStatus = main.querySelector("rkgk-connection-status");
document.getElementById("js-loading").remove();
reticleRenderer.connectViewport(canvasRenderer.viewport);
reticleRenderer.updateInterval = updateInterval;
function updateUrl(session, viewport) {
let url = new URL(window.location);
@ -231,7 +232,7 @@ function readUrl(urlString) {
}
});
let reportCursor = debounce(updateInterval, (x, y) => session.sendCursor(x, y));
let reportCursor = debounce(updateInterval, (x, y) => session.sendCursor(x, y), console.log);
canvasRenderer.addEventListener(".cursor", async (event) => {
reportCursor(event.x, event.y);
});