提交 c0802487 编写于 作者: J Joao Moreno

centered layout: propagate dimension constraints from view

上级 c5ef6da6
......@@ -32,9 +32,9 @@ function createEmptyView() {
function toSplitViewView(view: IView, getHeight: () => number): ISplitViewView {
return {
element: view.element,
maximumSize: view.maximumWidth,
minimumSize: view.minimumWidth,
onDidChange: mapEvent(view.onDidChange, widthAndHeight => widthAndHeight && widthAndHeight.width),
get maximumSize() { return view.maximumWidth; },
get minimumSize() { return view.minimumWidth; },
onDidChange: mapEvent(view.onDidChange, e => e && e.width),
layout: size => view.layout(size, getHeight())
};
}
......
......@@ -425,8 +425,17 @@ export class SplitView implements IDisposable {
size = typeof size === 'number' ? size : item.size;
size = clamp(size, item.view.minimumSize, item.view.maximumSize);
item.size = size;
this.relayout(index);
if (this.inverseAltBehavior && index > 0) {
// In this case, we want the view to grow or shrink both sides equally
// so we just resize the "left" side by half and let `resize` do the clamping magic
this.resize(index - 1, Math.floor((item.size - size) / 2));
this.distributeEmptySpace();
this.layoutViews();
} else {
item.size = size;
this.relayout(index, undefined);
}
}
resizeView(index: number, size: number): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册