This commit is contained in:
Alex Dima 2018-03-01 14:20:32 +01:00
parent 130981bce5
commit 8ed3513079

View file

@ -188,6 +188,7 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
this._disposables.push(this.editor.onDidLayoutChange((info: EditorLayoutInfo) => {
const width = this._getWidth(info);
this.domNode.style.width = width + 'px';
this.domNode.style.left = this._getLeft(info) + 'px';
this._onWidth(width);
}));
}
@ -250,10 +251,18 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
}
}
private _getWidth(info: EditorLayoutInfo = this.editor.getLayoutInfo()): number {
private _getWidth(info: EditorLayoutInfo): number {
return info.width - info.minimapWidth - info.verticalScrollbarWidth;
}
private _getLeft(info: EditorLayoutInfo): number {
// If minimap is to the left, we move beyond it
if (info.minimapWidth > 0 && info.minimapLeft === 0) {
return info.minimapWidth;
}
return 0;
}
private _onViewZoneTop(top: number): void {
this.domNode.style.top = top + 'px';
}
@ -263,7 +272,8 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
let containerHeight = height - this._decoratingElementsHeight();
this.container.style.height = `${containerHeight}px`;
this._doLayout(containerHeight, this._getWidth());
const layoutInfo = this.editor.getLayoutInfo();
this._doLayout(containerHeight, this._getWidth(layoutInfo));
this._resizeSash.layout();
}
@ -328,8 +338,10 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider {
column: where.startColumn
};
const width = this._getWidth();
const layoutInfo = this.editor.getLayoutInfo();
const width = this._getWidth(layoutInfo);
this.domNode.style.width = `${width}px`;
this.domNode.style.left = this._getLeft(layoutInfo) + 'px';
// Render the widget as zone (rendering) and widget (lifecycle)
const viewZoneDomNode = document.createElement('div');