From d3c51fbae45f5504f3d106dfdff6d6ac98968d27 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Wed, 18 Oct 2023 11:57:31 +0100 Subject: [PATCH] Fix fractional units messing up calculations Changed background-size to cover Revert dev changes --- app/styles/base.css | 3 ++- app/ui.js | 21 +++++++++++---------- vnc.html | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/styles/base.css b/app/styles/base.css index 179537da..ab8a0a1a 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -897,7 +897,8 @@ select:active { #noVNC_container { width: 100%; height: 100%; - background-image: url('../images/splash.jpg') + background-image: url('../images/splash.jpg'); + background-size: cover; } #noVNC_keyboardinput { diff --git a/app/ui.js b/app/ui.js index 6e7da90b..d5728604 100644 --- a/app/ui.js +++ b/app/ui.js @@ -31,8 +31,8 @@ window.updateSetting = (name, value) => { } } -//import "core-js/stable"; -//import "regenerator-runtime/runtime"; +import "core-js/stable"; +import "regenerator-runtime/runtime"; import * as Log from '../core/util/logging.js'; import _, { l10n } from './localization.js'; import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock } @@ -1880,10 +1880,10 @@ const UI = { } monitors.push({ id: screen.screenID, - x: screen.x / scale, - y: screen.y / scale, - w: screen.serverWidth / scale, - h: screen.serverHeight / scale, + x: Math.round(screen.x / scale), + y: Math.round(screen.y / scale), + w: Math.round(screen.serverWidth / scale), + h: Math.round(screen.serverHeight / scale), pixelRatio: screen.pixelRatio, scale: 1, fill: '#eeeeeecc', @@ -1900,7 +1900,10 @@ const UI = { UI.monitors = monitors let deepCopyMonitors = JSON.parse(JSON.stringify(monitors)) UI.sortedMonitors = deepCopyMonitors.sort((a, b) => { - return a.x - b.x || a.y - b.y + if (a.y >= b.y + (b.h / 2)) { + return 1 + } + return a.x - b.x }) }, @@ -1948,7 +1951,7 @@ const UI = { a.x = prevStart } if (a.x < prevStart) { - if (a.y <= prevStartTop) { + if (a.y < prevStartTop) { a.x = prevStart } } @@ -2109,8 +2112,6 @@ const UI = { } return a.x - b.x }) - // console.log(UI.monitors) - console.log(UI.sortedMonitors) UI.recenter() UI.draw() } diff --git a/vnc.html b/vnc.html index db95450d..2b3744d6 100644 --- a/vnc.html +++ b/vnc.html @@ -50,7 +50,7 @@ - +