mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 11:49:02 +08:00
修复缩放变化时窗口大小调整的冲突问题(仅调整位置,大小由组件管理)
This commit is contained in:
@@ -59,7 +59,7 @@ export class SettingsService extends Service {
|
|||||||
wc.setZoomFactor(zoom)
|
wc.setZoomFactor(zoom)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 更新全局侧边栏窗口的位置和大小
|
// 仅更新全局侧边栏窗口的位置(不调整大小,大小由 GlobalSidebar 组件管理)
|
||||||
const sidebarWindow = BrowserWindow.getAllWindows().find((win) => {
|
const sidebarWindow = BrowserWindow.getAllWindows().find((win) => {
|
||||||
try {
|
try {
|
||||||
return win.webContents.getURL().includes('#global-sidebar')
|
return win.webContents.getURL().includes('#global-sidebar')
|
||||||
@@ -71,16 +71,13 @@ export class SettingsService extends Service {
|
|||||||
if (sidebarWindow && !sidebarWindow.isDestroyed()) {
|
if (sidebarWindow && !sidebarWindow.isDestroyed()) {
|
||||||
const primaryDisplay = screen.getPrimaryDisplay()
|
const primaryDisplay = screen.getPrimaryDisplay()
|
||||||
const { width, height } = primaryDisplay.workAreaSize
|
const { width, height } = primaryDisplay.workAreaSize
|
||||||
const baseWidth = 84
|
const bounds = sidebarWindow.getBounds()
|
||||||
const baseHeight = 300
|
|
||||||
const winWidth = Math.round(baseWidth * zoom)
|
|
||||||
const winHeight = Math.round(baseHeight * zoom)
|
|
||||||
|
|
||||||
sidebarWindow.setBounds({
|
sidebarWindow.setBounds({
|
||||||
x: width - winWidth,
|
x: width - bounds.width,
|
||||||
y: Math.floor(height / 2 - winHeight / 2),
|
y: Math.floor(height / 2 - bounds.height / 2),
|
||||||
width: winWidth,
|
width: bounds.width,
|
||||||
height: winHeight
|
height: bounds.height
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user