[MM-44022] Switch to using current BrowserView for determining window bounds for URL view (#2087)
This commit is contained in:
@@ -6,7 +6,7 @@ import {BrowserViewConstructorOptions} from 'electron/main';
|
|||||||
|
|
||||||
import {Tab, TeamWithTabs} from 'types/config';
|
import {Tab, TeamWithTabs} from 'types/config';
|
||||||
|
|
||||||
import {SECOND} from 'common/utils/constants';
|
import {SECOND, TAB_BAR_HEIGHT} from 'common/utils/constants';
|
||||||
import {
|
import {
|
||||||
UPDATE_TARGET_URL,
|
UPDATE_TARGET_URL,
|
||||||
LOAD_SUCCESS,
|
LOAD_SUCCESS,
|
||||||
@@ -322,7 +322,7 @@ export class ViewManager {
|
|||||||
const localURL = getLocalURLString('urlView.html', query);
|
const localURL = getLocalURLString('urlView.html', query);
|
||||||
urlView.webContents.loadURL(localURL);
|
urlView.webContents.loadURL(localURL);
|
||||||
this.mainWindow.addBrowserView(urlView);
|
this.mainWindow.addBrowserView(urlView);
|
||||||
const boundaries = this.mainWindow.getBounds();
|
const boundaries = this.views.get(this.currentView || '')?.view.getBounds() ?? this.mainWindow.getBounds();
|
||||||
|
|
||||||
const hideView = () => {
|
const hideView = () => {
|
||||||
delete this.urlViewCancel;
|
delete this.urlViewCancel;
|
||||||
@@ -338,12 +338,15 @@ export class ViewManager {
|
|||||||
const adjustWidth = (event: IpcMainEvent, width: number) => {
|
const adjustWidth = (event: IpcMainEvent, width: number) => {
|
||||||
log.silly('showURLView.adjustWidth', width);
|
log.silly('showURLView.adjustWidth', width);
|
||||||
|
|
||||||
urlView.setBounds({
|
const bounds = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: boundaries.height - URL_VIEW_HEIGHT,
|
y: (boundaries.height + TAB_BAR_HEIGHT) - URL_VIEW_HEIGHT,
|
||||||
width: width + 5, // add some padding to ensure that we don't cut off the border
|
width: width + 5, // add some padding to ensure that we don't cut off the border
|
||||||
height: URL_VIEW_HEIGHT,
|
height: URL_VIEW_HEIGHT,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
log.silly('showURLView setBounds', boundaries, bounds);
|
||||||
|
urlView.setBounds(bounds);
|
||||||
};
|
};
|
||||||
|
|
||||||
ipcMain.on(UPDATE_URL_VIEW_WIDTH, adjustWidth);
|
ipcMain.on(UPDATE_URL_VIEW_WIDTH, adjustWidth);
|
||||||
|
Reference in New Issue
Block a user