Skip to content

Commit

Permalink
fix: view not properly hide, width: 0 can't hide it, need x: -content…
Browse files Browse the repository at this point in the history
…Size[0],
  • Loading branch information
linonetwo committed Jan 3, 2024
1 parent 6287fe4 commit e8c706d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/services/view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,18 @@ export class View implements IViewService {
public async hideView(browserWindow: BrowserWindow): Promise<void> {
const view = browserWindow.getBrowserView();
if (view !== null) {
// const contentSize = browserWindow.getContentSize();
view?.setBounds(await getViewBounds([0, 0], { findInPage: false }, 0, 0)); // hide browserView to show error message or other pages
const contentSize = browserWindow.getContentSize();
// disable view features
view?.setAutoResize({ horizontal: false, vertical: false });
view.webContents.stopFindInPage('clearSelection');
view.webContents.send(WindowChannel.closeFindInPage);
// make view small, hide browserView to show error message or other pages
view?.setBounds({
x: -contentSize[0],
y: -contentSize[1],
width: 0,
height: 0,
});
}
}
}

0 comments on commit e8c706d

Please sign in to comment.