Skip to content

Commit

Permalink
[Fix] Zoom now always retained after minimize, restore, etc. (#4020)
Browse files Browse the repository at this point in the history
Applied Prettier (again)
  • Loading branch information
hitgubian authored Nov 17, 2024
1 parent 5629445 commit 6bce834
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,21 @@ async function initializeWindow(): Promise<BrowserWindow> {
mainWindow.webContents.setVisualZoomLevelLimits(1, 1)
})

function applyZoom() {
const zoomFactor = processZoomForScreen(
configStore.get('zoomPercent', 100) / 100
)
mainWindow.webContents.setZoomLevel(zoomFactor)
mainWindow.webContents.setVisualZoomLevelLimits(1, 1)
}

mainWindow.on('maximize', applyZoom)
mainWindow.on('unmaximize', applyZoom)
mainWindow.on('restore', applyZoom)
mainWindow.on('enter-full-screen', applyZoom)
mainWindow.on('leave-full-screen', applyZoom)
mainWindow.webContents.on('did-navigate', applyZoom)

return mainWindow
}

Expand Down

0 comments on commit 6bce834

Please sign in to comment.