From 123be2dd4de6d70bfe356eb84f165ec30dc19b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferenc=20S=C3=A1rai?= Date: Thu, 28 Nov 2024 14:41:24 +0100 Subject: [PATCH] feat: improve screenshot plugin dimensions and styling --- src/plugins/screenshot/utils/index.ts | 4 ++-- src/plugins/screenshot/windows/preview/preview.css | 2 +- src/plugins/screenshot/windows/preview/preview.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/screenshot/utils/index.ts b/src/plugins/screenshot/utils/index.ts index 599e795..8a84888 100644 --- a/src/plugins/screenshot/utils/index.ts +++ b/src/plugins/screenshot/utils/index.ts @@ -51,8 +51,8 @@ export function getScreenSize(resizeBy = 3) { const scaleFactor = primaryDisplay.scaleFactor const defaultScreenSize = { - width: (width / resizeBy) * scaleFactor, - height: (height / resizeBy) * scaleFactor, + width: Math.floor((width / resizeBy) * scaleFactor), + height: Math.floor((height / resizeBy) * scaleFactor), } return { diff --git a/src/plugins/screenshot/windows/preview/preview.css b/src/plugins/screenshot/windows/preview/preview.css index 7c53ecf..f03861d 100644 --- a/src/plugins/screenshot/windows/preview/preview.css +++ b/src/plugins/screenshot/windows/preview/preview.css @@ -145,7 +145,7 @@ iframe { img { display: block; max-width: 90%; - max-height: 720px; + max-height: 75vh; object-fit: contain; } diff --git a/src/plugins/screenshot/windows/preview/preview.ts b/src/plugins/screenshot/windows/preview/preview.ts index 7aa704a..b3bff14 100644 --- a/src/plugins/screenshot/windows/preview/preview.ts +++ b/src/plugins/screenshot/windows/preview/preview.ts @@ -12,6 +12,7 @@ function createPreviewWindow(imgDataURL: string) { previewWindow = new BrowserWindow({ width: defaultScreenSize.width, height: defaultScreenSize.height, + useContentSize: true, resizable: false, webPreferences: { preload: path.join(__dirname, 'preview-preload.js'),