From 03fdb7c904bf6a476894c130e85b7dc3fb1319f9 Mon Sep 17 00:00:00 2001 From: Olivier Wulveryck Date: Wed, 15 Nov 2023 21:46:25 +0100 Subject: [PATCH] feat(wip): pointer in orientation --- client/main.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/client/main.js b/client/main.js index 950aa16..37f3e3a 100644 --- a/client/main.js +++ b/client/main.js @@ -109,10 +109,18 @@ function connectWebSocket() { } if (message.Type === 3) { // Code 3: Update and draw laser pointer - if (message.Code === 1) { // Horizontal position - latestX = scaleValue(message.Value, MAX_X_VALUE, canvasPresent.width); - } else if (message.Code === 0) { // Vertical position - latestY = canvasPresent.height - scaleValue(message.Value, MAX_Y_VALUE, canvasPresent.height); + if (rotate) { + if (message.Code === 1) { // Horizontal position + latestX = scaleValue(message.Value, MAX_X_VALUE, canvasPresent.width); + } else if (message.Code === 0) { // Vertical position + latestY = canvasPresent.height - scaleValue(message.Value, MAX_Y_VALUE, canvasPresent.height); + } + } else { + if (message.Code === 1) { // Horizontal position + latestX = canvasPresent.width - scaleValue(message.Value, MAX_X_VALUE, canvasPresent.width); + } else if (message.Code === 0) { // Vertical position + latestY = scaleValue(message.Value, MAX_Y_VALUE, canvasPresent.height); + } } if (draw) { drawLaser(latestX, latestY);