Fixes for scaling

This commit is contained in:
Chris Hunt 2023-10-26 09:39:42 +01:00
parent ac42423e5f
commit ae30357f0e
No known key found for this signature in database
2 changed files with 13 additions and 13 deletions

View File

@ -1900,10 +1900,10 @@ const UI = {
} }
monitors.push({ monitors.push({
id: screen.screenID, id: screen.screenID,
x: Math.round(screen.x / scale), x: screen.x / scale,
y: Math.round(screen.y / scale), y: screen.y / scale,
w: Math.round(screen.serverWidth / scale), w: screen.serverWidth / scale,
h: Math.round(screen.serverHeight / scale), h: screen.serverHeight / scale,
pixelRatio: screen.pixelRatio, pixelRatio: screen.pixelRatio,
scale: 1, scale: 1,
fill: '#eeeeeecc', fill: '#eeeeeecc',
@ -2059,15 +2059,15 @@ const UI = {
console.log(a) console.log(a)
screens.push({ screens.push({
screenID: a.id, screenID: a.id,
serverHeight: Math.floor(a.h * scale), serverHeight: Math.round(a.h * scale),
serverWidth: Math.floor(a.w * scale), serverWidth: Math.round(a.w * scale),
x: Math.floor((a.x - left) * scale), x: Math.round((a.x - left) * scale),
y: Math.floor((a.y - top) * scale) y: Math.round((a.y - top) * scale)
}) })
} }
const screenPlan = { const screenPlan = {
serverHeight: Math.floor(height * scale), serverHeight: Math.round(height * scale),
serverWidth: Math.floor(width * scale), serverWidth: Math.round(width * scale),
screens screens
} }
console.log('setScreenPlan') console.log('setScreenPlan')

View File

@ -13,13 +13,13 @@ const UI = {
controlChannel: null, controlChannel: null,
//Initial Loading of the UI //Initial Loading of the UI
prime() { prime() {
this.start();
console.log('prime') console.log('prime')
this.start();
}, },
//Render default UI //Render default UI
start() { start() {
console.log('prime') console.log('start')
window.addEventListener("beforeunload", (e) => { window.addEventListener("beforeunload", (e) => {
if (UI.rfb) { if (UI.rfb) {
UI.disconnect(); UI.disconnect();
@ -271,7 +271,7 @@ const UI = {
if (UI.rfb) { if (UI.rfb) {
UI.rfb.disconnect(); UI.rfb.disconnect();
if (UI.supportsBroadcastChannel) { if (UI.supportsBroadcastChannel) {
console.log('remove') console.log('remove event listeners')
UI.controlChannel.removeEventListener('message', UI.handleControlMessage); UI.controlChannel.removeEventListener('message', UI.handleControlMessage);
UI.rfb.removeEventListener("connect", UI.connectFinished); UI.rfb.removeEventListener("connect", UI.connectFinished);
} }