diff --git a/src/ipc/types.ts b/src/ipc/types.ts index fb031073..e41574ec 100644 --- a/src/ipc/types.ts +++ b/src/ipc/types.ts @@ -25,6 +25,7 @@ export interface Config { stashScroll: boolean subdomain: string widgets: Widget[] + fontSize: number } interface Widget { @@ -81,6 +82,7 @@ export const defaultConfig: Config = { searchStatRange: 10, stashScroll: true, subdomain: 'us', + fontSize: 16, widgets: [ // --- REQUIRED --- { diff --git a/src/main/SettingsWindow.ts b/src/main/SettingsWindow.ts index 650af922..467843c8 100644 --- a/src/main/SettingsWindow.ts +++ b/src/main/SettingsWindow.ts @@ -2,6 +2,7 @@ import path from 'path' import { BrowserWindow, dialog } from 'electron' import { PoeWindow } from './PoeWindow' import { isInteractable } from './overlay-window' +import { config } from './config' let settingsWindow: BrowserWindow | undefined @@ -29,14 +30,15 @@ export function createWindow () { } settingsWindow = new BrowserWindow({ - width: 800, - height: 600, + width: 50 * config.get('fontSize'), + height: 37.5 * config.get('fontSize'), icon: path.join(__static, 'icon.png'), fullscreenable: false, frame: false, backgroundColor: '#2d3748', // gray-800 webPreferences: { - nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION as any + nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION as any, + defaultFontSize: config.get('fontSize') } }) diff --git a/src/main/builtin-browser.ts b/src/main/builtin-browser.ts index 1f248658..98abe370 100644 --- a/src/main/builtin-browser.ts +++ b/src/main/builtin-browser.ts @@ -3,8 +3,9 @@ import * as ipc from '@/ipc/ipc-event' import { DPR, overlayWindow, handleExtraCommands } from './overlay-window' import { PoeWindow } from './PoeWindow' import { logger } from './logger' +import { config } from './config' -const WIDTH_96DPI = 460 +const WIDTH_96DPI = 460 / 16 let browserViewExternal: BrowserView | undefined @@ -12,7 +13,7 @@ export function setupBuiltinBrowser () { ipcMain.on(ipc.SHOW_BROWSER, (e, opts: ipc.IpcShowBrowser) => { logger.debug('Show', { source: 'builtin-browser', opts }) if (!browserViewExternal) { - browserViewExternal = new BrowserView() + browserViewExternal = new BrowserView({ webPreferences: { zoomFactor: config.get('fontSize') / 16 } }) // hopefully someday this will enable subpixel AA // browserViewExternal.setBackgroundColor('#2d3748') // gray-800 browserViewExternal.webContents.on('before-input-event', handleExtraCommands) @@ -22,7 +23,7 @@ export function setupBuiltinBrowser () { let browserBounds = { x: 0, y: 0, - width: PoeWindow.bounds!.width - Math.floor(WIDTH_96DPI * DPR), + width: PoeWindow.bounds!.width - Math.floor(WIDTH_96DPI * DPR * config.get('fontSize')), height: PoeWindow.bounds!.height } if (process.platform === 'win32') { diff --git a/src/main/config.ts b/src/main/config.ts index bba02a4a..0985b547 100644 --- a/src/main/config.ts +++ b/src/main/config.ts @@ -42,6 +42,10 @@ export const config = (() => { } } + if (typeof config.get('fontSize') !== 'number') { + config.set('fontSize', defaultConfig.fontSize) + } + return config })() diff --git a/src/main/overlay-window.ts b/src/main/overlay-window.ts index 61c213d8..3e99262f 100644 --- a/src/main/overlay-window.ts +++ b/src/main/overlay-window.ts @@ -31,7 +31,8 @@ export async function createOverlayWindow () { // backgroundColor: '#00000008', webPreferences: { nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION as any, - webSecurity: false + webSecurity: false, + defaultFontSize: config.get('fontSize') } }) diff --git a/src/main/price-check.ts b/src/main/price-check.ts index d300f67e..3073662e 100644 --- a/src/main/price-check.ts +++ b/src/main/price-check.ts @@ -7,8 +7,8 @@ import { config } from './config' import { logger } from './logger' import { overlayWindow, isInteractable, assertOverlayActive, assertPoEActive, DPR } from './overlay-window' -const WIDTH_96DPI = 460 -const CLOSE_THRESHOLD_96DPI = 40 +const WIDTH_96DPI = 460 / 16 +const CLOSE_THRESHOLD_96DPI = 40 / 16 let isPriceCheckShown = false let isClickedAfterLock = false @@ -30,7 +30,7 @@ export function showWidget (opts: { activeAreaRect = { x: getOffsetX(checkPressPosition!, poeBounds), y: poeBounds.y, - width: Math.floor(WIDTH_96DPI * DPR), + width: Math.floor(WIDTH_96DPI * DPR * config.get('fontSize')), height: poeBounds.height } @@ -64,7 +64,7 @@ export function setupShowHide () { if (!isPollingClipboard && !isInteractable && modifier !== config.get('priceCheckKeyHold')) { const distance = Math.hypot(e.x - checkPressPosition!.x, e.y - checkPressPosition!.y) - if (distance > (CLOSE_THRESHOLD_96DPI * DPR)) { + if (distance > (CLOSE_THRESHOLD_96DPI * DPR * config.get('fontSize'))) { logger.debug('Closing', { source: 'price-check', reason: 'Auto-hide on mouse move', distance, threshold: CLOSE_THRESHOLD_96DPI }) overlayWindow!.webContents.send(ipc.PRICE_CHECK_CANCELED) isPriceCheckShown = false @@ -124,7 +124,7 @@ function isPointInsideRect (point: Point, rect: Rectangle) { function getOffsetX (mousePos: Point, poePos: Rectangle): number { if (mousePos.x > (poePos.x + poePos.width / 2)) { // inventory - return (poePos.x + poePos.width) - PoeWindow.uiSidebarWidth - Math.floor(WIDTH_96DPI * DPR) + return (poePos.x + poePos.width) - PoeWindow.uiSidebarWidth - Math.floor(WIDTH_96DPI * DPR * config.get('fontSize')) } else { // stash or chat return poePos.x + PoeWindow.uiSidebarWidth diff --git a/src/web/App.vue b/src/web/App.vue index 305b54f6..7dc65ba0 100644 --- a/src/web/App.vue +++ b/src/web/App.vue @@ -35,15 +35,21 @@ } ::-webkit-scrollbar { - width: 14px; + width: 0.875rem; } ::-webkit-scrollbar-track { - -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + -webkit-box-shadow: inset 0 0 0.375rem rgba(0,0,0,0.3); } ::-webkit-scrollbar-thumb { - -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); + -webkit-box-shadow: inset 0 0 0.375rem rgba(0,0,0,0.5); +} + +.popper { + font-size: 0.875rem !important; + border-radius: 0.25rem !important; + padding: 0.125rem !important; } .btn { diff --git a/src/web/map-check/WidgetMapCheck.vue b/src/web/map-check/WidgetMapCheck.vue index 9666a407..c585b285 100644 --- a/src/web/map-check/WidgetMapCheck.vue +++ b/src/web/map-check/WidgetMapCheck.vue @@ -1,6 +1,6 @@