Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
corentin-soriano committed Nov 3, 2024
1 parent 691ebed commit 99d1319
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ angular.module('client').controller('secondaryMonitorController', ['$scope', '$i
let displayHeight = 0;
let monitorPosition = 0;
let monitorsCount = 0;
let currentScaling = 1;

/**
* In order to open the guacamole menu, we need to hit ctrl-alt-shift. There are
Expand Down Expand Up @@ -88,10 +89,11 @@ angular.module('client').controller('secondaryMonitorController', ['$scope', '$i

// Use the lowest scaling to avoid acreen overflow
if (scaleX <= scaleY)
display.scale(scaleX);
currentScaling = scaleX;
else
display.scale(scaleY);

currentScaling = scaleY;

display.scale(currentScaling);
};

// Send monitor-close event to broadcast channel on window unload
Expand All @@ -111,8 +113,8 @@ angular.module('client').controller('secondaryMonitorController', ['$scope', '$i

// Update client-side cursor
display.moveCursor(
Math.floor(e.state.x),
Math.floor(e.state.y)
Math.floor(e.state.x / currentScaling),
Math.floor(e.state.y / currentScaling)
);

// Limit mouse move events to reduce latency
Expand All @@ -133,8 +135,8 @@ angular.module('client').controller('secondaryMonitorController', ['$scope', '$i
mouseState.left = e.state.left;
mouseState.middle = e.state.middle;
mouseState.right = e.state.right;
mouseState.x = e.state.x + displayOffset;
mouseState.y = e.state.y;
mouseState.x = e.state.x / currentScaling + displayOffset;
mouseState.y = e.state.y / currentScaling;
mouseState.lastPush = Date.now();

// Send mouse state to main window
Expand Down

0 comments on commit 99d1319

Please sign in to comment.