From ff7e9dcae776c1114ac1c20f9c2206e54e420885 Mon Sep 17 00:00:00 2001 From: JChehe <574805242@qq.com> Date: Thu, 29 Jun 2017 11:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AA=97=E5=8F=A3=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=8C=96=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E2=80=9C?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=B0=8F=E7=AA=97=E5=8F=A3=E2=80=9D=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ipcMainSets.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/ipcMainSets.js b/app/ipcMainSets.js index 63aae18..7b0332a 100644 --- a/app/ipcMainSets.js +++ b/app/ipcMainSets.js @@ -222,13 +222,15 @@ module.exports = function (mainWindow, backgroundWindow) { ipcMain.on('sync-close', (event, arg) => { mainWindow.close() }) + + // 默认窗口大小,当不指定 x,y 时,则为居中。 + let windowBounds = { + width: 1280, + height: 850 + } ipcMain.on('sync-maximize', (event, arg) => { - let windowBounds = { - width: 1280, - height: 850 - } if (mainWindow.isMaximized()) { - mainWindow.setBounds(windowBounds) + mainWindow.setBounds(windowBounds, true) } else { windowBounds = mainWindow.getBounds() mainWindow.maximize()