mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 03:10:08 +08:00
fix: Ctrl + - 缩放时 缩到最小 再缩的话会报错 #266
This commit is contained in:
parent
5db5190e44
commit
b4d5595b68
@ -6,7 +6,11 @@ export function registerZoomShortcut(mainWindow: BrowserWindow) {
|
||||
globalShortcut.register('CommandOrControl+=', () => {
|
||||
if (mainWindow) {
|
||||
const currentZoom = mainWindow.webContents.getZoomFactor()
|
||||
mainWindow.webContents.setZoomFactor(currentZoom + 0.1)
|
||||
const newZoom = currentZoom + 0.1
|
||||
// Prevent zoom factor from exceeding reasonable limits
|
||||
if (newZoom <= 5.0) {
|
||||
mainWindow.webContents.setZoomFactor(newZoom)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -14,7 +18,11 @@ export function registerZoomShortcut(mainWindow: BrowserWindow) {
|
||||
globalShortcut.register('CommandOrControl+-', () => {
|
||||
if (mainWindow) {
|
||||
const currentZoom = mainWindow.webContents.getZoomFactor()
|
||||
mainWindow.webContents.setZoomFactor(currentZoom - 0.1)
|
||||
const newZoom = currentZoom - 0.1
|
||||
// Prevent zoom factor from going below 0.1
|
||||
if (newZoom >= 0.1) {
|
||||
mainWindow.webContents.setZoomFactor(newZoom)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user