提交 cc2a1649 编写于 作者: B Benjamin Pasero 提交者: Benjamin Pasero

fix #53424 (#53425)

上级 fd4bf73a
......@@ -27,14 +27,6 @@ export interface IView {
layout(width: number, height: number): void;
}
/*
TODO:
- NEW: add a color to show a border where the sash is, similar to how other
widgets have a color (e.g. Button, with applyStyles). Challenge is that this
color has to be applied via JS and not CSS to not apply it to all views
NOT CSS
*/
export function orthogonal(orientation: Orientation): Orientation {
return orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL;
}
......
......@@ -35,7 +35,7 @@ import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTa
import { localize } from 'vs/nls';
import { Color } from 'vs/base/common/color';
import { CenteredViewLayout } from 'vs/base/browser/ui/centered/centeredViewLayout';
import { IView } from 'vs/base/browser/ui/grid/gridview';
import { IView, orthogonal } from 'vs/base/browser/ui/grid/gridview';
interface IEditorPartUIState {
serializedGrid: ISerializedGrid;
......@@ -414,7 +414,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
const gridDescriptor = createSerializedGrid({
orientation: this.toGridViewOrientation(
layout.orientation,
(this.gridWidget.orientation === Orientation.VERTICAL) ? Orientation.HORIZONTAL : Orientation.VERTICAL // fix https://github.com/Microsoft/vscode/issues/52975
this.isTwoDimensionalGrid() ?
this.gridWidget.orientation : // preserve original orientation for 2-dimensional grids
orthogonal(this.gridWidget.orientation) // otherwise flip (fix https://github.com/Microsoft/vscode/issues/52975)
),
groups: layout.groups
});
......@@ -444,6 +446,17 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
}
}
private isTwoDimensionalGrid(): boolean {
const views = this.gridWidget.getViews();
if (isGridBranchNode(views)) {
// the grid is 2-dimensional if any children
// of the grid is a branch node
return views.children.some(child => isGridBranchNode(child));
}
return false;
}
addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView {
const locationView = this.assertGroupView(location);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册