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
+12 -1
View File
@@ -1,6 +1,6 @@
import { Service } from '../../shared/kernel'
import { MainContext } from '../context'
import { BrowserWindow } from 'electron'
import { BrowserWindow, webContents } from 'electron'
import type { IpcMainInvokeEvent } from 'electron'
import type { settingsKey, settingsSpec, settingChange } from '../../preload/types'
import type { permissionLevel } from './PermissionService'
@@ -48,6 +48,17 @@ export class SettingsService extends Service {
onChanged: (ctx, next) => {
ctx.logger.setLevel(next as any)
}
},
window_zoom: {
kind: 'number',
defaultValue: 1.0,
writePermission: 'admin',
onChanged: (_ctx, next) => {
const zoom = Number(next) || 1.0
webContents.getAllWebContents().forEach((wc: any) => {
wc.setZoomFactor(zoom)
})
}
}
}