mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 18:19:03 +08:00
feat(ui): 添加窗口缩放功能支持
实现窗口缩放功能,允许用户在设置中选择70%-150%的界面缩放比例 添加相关IPC通信和设置项处理逻辑 更新设置界面添加缩放选项控件
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user