From b506c7a938103a3536cc7c4149fb0bce4f0dc7ba Mon Sep 17 00:00:00 2001 From: GrylledCheez <68041324+GrylledCheez@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:14:43 -1000 Subject: [PATCH] unfixed monitor math It seems that I removed more math than I should have in c4b8c835ad6af9e206f01a31b782bae04ba8289c I've reverted the change but updated the variables --- extension.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 37037a9..967ff3e 100644 --- a/extension.js +++ b/extension.js @@ -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}`);