From 10728803baffa390af8cd5ee0d1caa2c4b5ee4ef Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 24 Jul 2018 21:01:31 -0500 Subject: [PATCH 1/3] Fix popup size issue --- src/popup.ts | 4 ++++ src/ui/menu.ts | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/popup.ts b/src/popup.ts index 3cc0b1ba2..50df55cf6 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -109,6 +109,10 @@ async function init() { } }); + if (ui.instance.isPopup()) { + ui.instance.fixPopupSize(); + } + return; } diff --git a/src/ui/menu.ts b/src/ui/menu.ts index 8439cbcf1..9c0521eae 100644 --- a/src/ui/menu.ts +++ b/src/ui/menu.ts @@ -145,6 +145,24 @@ async function menu(_ui: UI) { new URLSearchParams(document.location.search.substring(1)); return params.get('popup'); }, + fixPopupSize: () => { + const zoom = Number(localStorage.zoom) / 100 || 1; + const correctHeight = 480 * zoom; + const correctWidth = 320 * zoom; + if (window.innerHeight !== correctHeight || + window.innerWidth !== correctWidth) { + chrome.windows.getCurrent((currentWindow) => { + // window update to correct size + const adjustedHeight = + window.innerHeight + (correctHeight - window.innerHeight); + const adjustedWidth = + window.innerWidth + (correctWidth - window.innerWidth); + chrome.windows.update( + currentWindow.id, + {height: adjustedHeight, width: adjustedWidth}); + }); + } + }, dropboxUpload: async () => { const dbox = new Dropbox(); const response = await dbox.upload(_ui.instance.encryption); From e1d625dc56d103ada63b211c88646d9eded9e550 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Wed, 25 Jul 2018 10:58:02 -0500 Subject: [PATCH 2/3] Remove unnecessary code --- src/ui/menu.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ui/menu.ts b/src/ui/menu.ts index 9c0521eae..42201d2a0 100644 --- a/src/ui/menu.ts +++ b/src/ui/menu.ts @@ -152,14 +152,9 @@ async function menu(_ui: UI) { if (window.innerHeight !== correctHeight || window.innerWidth !== correctWidth) { chrome.windows.getCurrent((currentWindow) => { - // window update to correct size - const adjustedHeight = - window.innerHeight + (correctHeight - window.innerHeight); - const adjustedWidth = - window.innerWidth + (correctWidth - window.innerWidth); chrome.windows.update( currentWindow.id, - {height: adjustedHeight, width: adjustedWidth}); + {height: correctHeight, width: correctWidth}); }); } }, From e734df8b5b35e1ac7369f228f2d7995dc89b43f4 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Wed, 25 Jul 2018 11:37:30 -0500 Subject: [PATCH 3/3] gts fix --- src/ui/menu.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/menu.ts b/src/ui/menu.ts index 42201d2a0..f9bccefe1 100644 --- a/src/ui/menu.ts +++ b/src/ui/menu.ts @@ -153,8 +153,7 @@ async function menu(_ui: UI) { window.innerWidth !== correctWidth) { chrome.windows.getCurrent((currentWindow) => { chrome.windows.update( - currentWindow.id, - {height: correctHeight, width: correctWidth}); + currentWindow.id, {height: correctHeight, width: correctWidth}); }); } },