Skip to content

Commit ff7e9dc

Browse files
committed
修复窗口最大化时,点击“恢复小窗口”时报错的BUG
1 parent 0533384 commit ff7e9dc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/ipcMainSets.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,15 @@ module.exports = function (mainWindow, backgroundWindow) {
222222
ipcMain.on('sync-close', (event, arg) => {
223223
mainWindow.close()
224224
})
225+
226+
// 默认窗口大小,当不指定 x,y 时,则为居中。
227+
let windowBounds = {
228+
width: 1280,
229+
height: 850
230+
}
225231
ipcMain.on('sync-maximize', (event, arg) => {
226-
let windowBounds = {
227-
width: 1280,
228-
height: 850
229-
}
230232
if (mainWindow.isMaximized()) {
231-
mainWindow.setBounds(windowBounds)
233+
mainWindow.setBounds(windowBounds, true)
232234
} else {
233235
windowBounds = mainWindow.getBounds()
234236
mainWindow.maximize()

0 commit comments

Comments
 (0)