From 842eb1cd26eb8f2a3706c94151d5aec4cc7f2364 Mon Sep 17 00:00:00 2001 From: Michael Hollister Date: Wed, 16 Jul 2025 14:22:52 -0500 Subject: [PATCH] webOS: Fixed emulator resolution check --- receivers/webos/fcast-receiver/lib/common.ts | 48 ++++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/receivers/webos/fcast-receiver/lib/common.ts b/receivers/webos/fcast-receiver/lib/common.ts index 96b2aa4..64a7a8c 100644 --- a/receivers/webos/fcast-receiver/lib/common.ts +++ b/receivers/webos/fcast-receiver/lib/common.ts @@ -89,29 +89,39 @@ export class ServiceManager { // CSS media queries do not work on older webOS versions... export function initializeWindowSizeStylesheet() { - const resolution = sessionStorage.getItem('resolution'); - - if (resolution) { - window.onload = () => { - if (resolution == '1920x1080') { - document.head.insertAdjacentHTML('beforeend', ''); - } - else { - document.head.insertAdjacentHTML('beforeend', ''); - } + if (window.innerWidth !== 0 && window.innerHeight !== 0) { + if (window.innerWidth >= 1920 && window.innerHeight >= 1080) { + document.head.insertAdjacentHTML('beforeend', ''); + } + else { + document.head.insertAdjacentHTML('beforeend', ''); } } else { - window.onresize = () => { - if (window.innerWidth >= 1920 && window.innerHeight >= 1080) { - sessionStorage.setItem('resolution', '1920x1080'); - document.head.insertAdjacentHTML('beforeend', ''); + const resolution = sessionStorage.getItem('resolution'); + + if (resolution) { + window.onload = () => { + if (resolution == '1920x1080') { + document.head.insertAdjacentHTML('beforeend', ''); + } + else { + document.head.insertAdjacentHTML('beforeend', ''); + } } - else { - sessionStorage.setItem('resolution', '1280x720'); - document.head.insertAdjacentHTML('beforeend', ''); - } - }; + } + else { + window.onresize = () => { + if (window.innerWidth >= 1920 && window.innerHeight >= 1080) { + sessionStorage.setItem('resolution', '1920x1080'); + document.head.insertAdjacentHTML('beforeend', ''); + } + else { + sessionStorage.setItem('resolution', '1280x720'); + document.head.insertAdjacentHTML('beforeend', ''); + } + }; + } } }