提交 2a5d48c7 编写于 作者: M Matt Bierner

Fixing some titleBar NPEs

Introduced in  f95965a8 Just assume zero size if element is undefined
上级 565c88f4
......@@ -499,12 +499,12 @@ export class TitlebarPart extends Part implements ITitleService {
private adjustTitleMarginToCenter(): void {
setTimeout(() => {
// Center the title in the window
const currentAppIconWidth = parseInt(getComputedStyle(this.appIcon).width, 10);
const currentAppIconWidth = this.appIcon ? parseInt(getComputedStyle(this.appIcon).width, 10) : 0;
let currentMenubarWidth = parseInt(getComputedStyle(this.menubar).width, 10);
currentMenubarWidth = isNaN(currentMenubarWidth) ? 0 : currentMenubarWidth;
const currentTotalWidth = parseInt(getComputedStyle(document.body).width, 10);
const currentTitleWidth = parseInt(getComputedStyle(this.title).width, 10);
const currentWindowControlsWidth = parseInt(getComputedStyle(this.windowControls).width, 10);
const currentWindowControlsWidth = this.windowControls ? parseInt(getComputedStyle(this.windowControls).width, 10) : 0;
let leftMargin = (currentTotalWidth / 2) - (currentTitleWidth / 2) - (currentMenubarWidth + currentAppIconWidth);
let rightMargin = currentTotalWidth - (currentAppIconWidth + currentMenubarWidth + leftMargin + currentTitleWidth + currentWindowControlsWidth);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册