feat(ui): 添加窗口缩放功能支持

实现窗口缩放功能,允许用户在设置中选择70%-150%的界面缩放比例
添加相关IPC通信和设置项处理逻辑
更新设置界面添加缩放选项控件
This commit is contained in:
Linkon
2026-01-18 21:54:45 +08:00
parent e625ef0c50
commit e9f994b511
7 changed files with 180 additions and 37 deletions
+10
View File
@@ -72,6 +72,9 @@ export class WindowManager extends Service {
...input.options
})
const zoom = Number(this.mainCtx.settings.getValue('window_zoom')) || 1.0
win.webContents.setZoomFactor(zoom)
this.windows.set(input.key, win)
win.on('closed', () => {
this.windows.delete(input.key)
@@ -182,6 +185,13 @@ export class WindowManager extends Service {
return win ? win.isMaximized() : false
})
this.mainCtx.handle('window:set-zoom', (event, zoom: number) => {
const win = BrowserWindow.fromWebContents(event.sender)
if (win && zoom >= 0.5 && zoom <= 2.0) {
win.webContents.setZoomFactor(zoom)
}
})
this.mainCtx.handle('window:toggle-devtools', (event) => {
const win = BrowserWindow.fromWebContents(event.sender)
if (win) {