From a337895a38315e86f9bd2b2876fbe4cdb3c9186c Mon Sep 17 00:00:00 2001 From: Volodymyr Shatsky Date: Tue, 31 May 2016 10:19:23 +0300 Subject: [PATCH] Recalculate dimensions on devtools toggle. --- src/views/1_ApplicationComponent.tsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/views/1_ApplicationComponent.tsx b/src/views/1_ApplicationComponent.tsx index 6e04f3b18..a45e0ea84 100644 --- a/src/views/1_ApplicationComponent.tsx +++ b/src/views/1_ApplicationComponent.tsx @@ -30,18 +30,23 @@ export default class ApplicationComponent extends React.Component<{}, State> { .on("move", () => saveWindowBounds(focusedWindow)) .on("resize", () => { saveWindowBounds(focusedWindow); - - for (const tab of this.tabs) { - tab.updateAllSessionsDimensions(); - } - }); + this.recalculateDimensions(); + }) + .webContents + .on("devtools-opened", () => this.recalculateDimensions()) + .on("devtools-closed", () => this.recalculateDimensions()); ipcRenderer.on("change-working-directory", (event: Electron.IpcRendererEvent, directory: string) => this.activeTab.activeSession().directory = directory ); window.onbeforeunload = () => { - focusedWindow.removeAllListeners(); + focusedWindow + .removeAllListeners() + .webContents + .removeAllListeners("devtools-opened") + .removeAllListeners("devtools-closed"); + this.closeAllTabs(); } } @@ -162,6 +167,12 @@ export default class ApplicationComponent extends React.Component<{}, State> { }; } + private recalculateDimensions() { + for (const tab of this.tabs) { + tab.updateAllSessionsDimensions(); + } + } + public closeSession(sessionToClose: Session) { for (const tab of this.tabs) { for (const session of tab.sessions) {