Skip to content

Commit

Permalink
unfixed monitor math
Browse files Browse the repository at this point in the history
It seems that I removed more math than I should have in c4b8c83
I've reverted the change but updated the variables
  • Loading branch information
GrylledCheez committed Sep 6, 2023
1 parent d33631a commit b506c7a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,23 @@ function sendMove(direction, ctrlPressed = false) {

let monitorToLeft = -1;
let monitorToRight = -1;
_log(`sendMove) curMonitor: ${JSON.stringify(curMonitor)}`);
for (var i = 0; i < Main.layoutManager.monitors.length; i++) {
if (i === monitorIndex)
continue;

let testMonitor = getMonitorInfo(i);
_log(`sendMove) curMonitor: ${JSON.stringify(curMonitor)}`);
let monitorHeightDiff = Math.abs(testMonitor.height - curMonitor.height);
_log(`sendMove) testMonitor: ${JSON.stringify(testMonitor)}`);
_log(`sendMove) monitorsHeightDiff :${monitorHeightDiff}`);

if (testMonitor.x + testMonitor.width === curMonitor.x)
if (testMonitor.x < curMonitor.x &&
Math.abs(testMonitor.y - curMonitor.y) < (100 + monitorHeightDiff) &&
(monitorToLeft === -1 || (monitorToLeft >= 0 && testMonitor.x > Main.layoutManager.monitors[monitorToLeft].x)))
monitorToLeft = i;

if (curMonitor.x + curMonitor.width === testMonitor.x)
if (testMonitor.x > curMonitor.x && Math.abs(testMonitor.y - curMonitor.y) < (100 + monitorHeightDiff) &&
(monitorToRight === -1 || (monitorToRight >= 0 && testMonitor.x < Main.layoutManager.monitors[monitorToRight].x)))
monitorToRight = i;
}
_log(`sendMove) monitorToLeft: ${monitorToLeft} monitorToRight: ${monitorToRight}`);
Expand Down

0 comments on commit b506c7a

Please sign in to comment.