Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
4dbe064b
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4dbe064b
编写于
6月 20, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
better grid 2x2
fixes #52333
上级
76cdeb79
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
85 addition
and
16 deletion
+85
-16
src/vs/base/browser/ui/grid/grid.ts
src/vs/base/browser/ui/grid/grid.ts
+2
-1
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+83
-15
未找到文件。
src/vs/base/browser/ui/grid/grid.ts
浏览文件 @
4dbe064b
...
...
@@ -467,7 +467,6 @@ export class SerializableGrid<T extends ISerializableView> extends Grid<T> {
result
.
orientation
=
orientation
;
result
.
restoreViews
(
firstLeaf
.
view
,
orientation
,
root
);
result
.
initialLayoutContext
=
{
width
,
height
,
root
};
result
.
gridview
.
trySet2x2
();
return
result
;
}
...
...
@@ -496,6 +495,8 @@ export class SerializableGrid<T extends ISerializableView> extends Grid<T> {
this
.
restoreViewsSize
([],
this
.
initialLayoutContext
.
root
,
this
.
orientation
,
widthScale
,
heightScale
);
this
.
initialLayoutContext
=
undefined
;
this
.
gridview
.
trySet2x2
();
}
}
...
...
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
4dbe064b
...
...
@@ -75,7 +75,7 @@ export interface IGridViewOptions {
class
BranchNode
implements
ISplitView
,
IDisposable
{
readonly
element
:
HTMLElement
;
readonly
children
:
Node
[];
readonly
children
:
Node
[]
=
[]
;
private
splitview
:
SplitView
;
private
_size
:
number
;
...
...
@@ -127,8 +127,9 @@ class BranchNode implements ISplitView, IDisposable {
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
maximumSize
:
this
.
maximumOrthogonalSize
;
}
private
_onDidChange
:
Emitter
<
number
|
undefined
>
;
get
onDidChange
():
Event
<
number
|
undefined
>
{
return
this
.
_onDidChange
.
event
;
}
private
_onDidChange
=
new
Emitter
<
number
|
undefined
>
();
readonly
onDidChange
:
Event
<
number
|
undefined
>
=
this
.
_onDidChange
.
event
;
private
childrenChangeDisposable
:
IDisposable
=
EmptyDisposable
;
private
_onDidSashReset
=
new
Emitter
<
number
[]
>
();
...
...
@@ -151,9 +152,6 @@ class BranchNode implements ISplitView, IDisposable {
this
.
_size
=
size
;
this
.
_orthogonalSize
=
orthogonalSize
;
this
.
_onDidChange
=
new
Emitter
<
number
|
undefined
>
();
this
.
children
=
[];
this
.
element
=
$
(
'
.monaco-grid-branch-node
'
);
this
.
splitview
=
new
SplitView
(
this
.
element
,
{
orientation
,
styles
});
this
.
splitview
.
layout
(
size
);
...
...
@@ -297,11 +295,44 @@ class BranchNode implements ISplitView, IDisposable {
return
EmptyDisposable
;
}
const
[
firstChild
,
secondChild
]
=
this
.
children
;
const
[
otherFirstChild
,
otherSecondChild
]
=
other
.
children
;
if
(
!
(
firstChild
instanceof
LeafNode
)
||
!
(
secondChild
instanceof
LeafNode
))
{
return
EmptyDisposable
;
}
if
(
!
(
otherFirstChild
instanceof
LeafNode
)
||
!
(
otherSecondChild
instanceof
LeafNode
))
{
return
EmptyDisposable
;
}
if
(
this
.
orientation
===
Orientation
.
VERTICAL
)
{
secondChild
.
linkedWidthNode
=
otherFirstChild
.
linkedHeightNode
=
firstChild
;
firstChild
.
linkedWidthNode
=
otherSecondChild
.
linkedHeightNode
=
secondChild
;
otherSecondChild
.
linkedWidthNode
=
firstChild
.
linkedHeightNode
=
otherFirstChild
;
otherFirstChild
.
linkedWidthNode
=
secondChild
.
linkedHeightNode
=
otherSecondChild
;
}
else
{
otherFirstChild
.
linkedWidthNode
=
secondChild
.
linkedHeightNode
=
firstChild
;
otherSecondChild
.
linkedWidthNode
=
firstChild
.
linkedHeightNode
=
secondChild
;
firstChild
.
linkedWidthNode
=
otherSecondChild
.
linkedHeightNode
=
otherFirstChild
;
secondChild
.
linkedWidthNode
=
otherFirstChild
.
linkedHeightNode
=
otherSecondChild
;
}
const
mySash
=
this
.
splitview
.
sashes
[
0
];
const
otherSash
=
other
.
splitview
.
sashes
[
0
];
mySash
.
linkedSash
=
otherSash
;
otherSash
.
linkedSash
=
mySash
;
return
toDisposable
(()
=>
mySash
.
linkedSash
=
otherSash
.
linkedSash
=
undefined
);
this
.
_onDidChange
.
fire
();
other
.
_onDidChange
.
fire
();
return
toDisposable
(()
=>
{
mySash
.
linkedSash
=
otherSash
.
linkedSash
=
undefined
;
firstChild
.
linkedHeightNode
=
firstChild
.
linkedWidthNode
=
undefined
;
secondChild
.
linkedHeightNode
=
secondChild
.
linkedWidthNode
=
undefined
;
otherFirstChild
.
linkedHeightNode
=
otherFirstChild
.
linkedWidthNode
=
undefined
;
otherSecondChild
.
linkedHeightNode
=
otherSecondChild
.
linkedWidthNode
=
undefined
;
});
}
dispose
():
void
{
...
...
@@ -326,12 +357,37 @@ class LeafNode implements ISplitView, IDisposable {
readonly
onDidSashReset
:
Event
<
number
[]
>
=
Event
.
None
;
private
_onDidLinkedWidthNodeChange
=
new
Relay
<
number
|
undefined
>
();
private
_linkedWidthNode
:
LeafNode
|
undefined
=
undefined
;
get
linkedWidthNode
():
LeafNode
|
undefined
{
return
this
.
_linkedWidthNode
;
}
set
linkedWidthNode
(
node
:
LeafNode
|
undefined
)
{
this
.
_onDidLinkedWidthNodeChange
.
input
=
node
?
node
.
_onDidViewChange
:
Event
.
None
;
this
.
_linkedWidthNode
=
node
;
this
.
_onDidSetLinkedNode
.
fire
();
}
private
_onDidLinkedHeightNodeChange
=
new
Relay
<
number
|
undefined
>
();
private
_linkedHeightNode
:
LeafNode
|
undefined
=
undefined
;
get
linkedHeightNode
():
LeafNode
|
undefined
{
return
this
.
_linkedHeightNode
;
}
set
linkedHeightNode
(
node
:
LeafNode
|
undefined
)
{
this
.
_onDidLinkedHeightNodeChange
.
input
=
node
?
node
.
_onDidViewChange
:
Event
.
None
;
this
.
_linkedHeightNode
=
node
;
this
.
_onDidSetLinkedNode
.
fire
();
}
private
_onDidSetLinkedNode
=
new
Emitter
<
number
|
undefined
>
();
private
_onDidViewChange
:
Event
<
number
|
undefined
>
;
readonly
onDidChange
:
Event
<
number
|
undefined
>
;
constructor
(
readonly
view
:
IView
,
readonly
orientation
:
Orientation
,
orthogonalSize
:
number
=
0
)
{
this
.
_orthogonalSize
=
orthogonalSize
;
this
.
_onDidViewChange
=
mapEvent
(
this
.
view
.
onDidChange
,
this
.
orientation
===
Orientation
.
HORIZONTAL
?
e
=>
e
&&
e
.
width
:
e
=>
e
&&
e
.
height
);
this
.
onDidChange
=
anyEvent
(
this
.
_onDidViewChange
,
this
.
_onDidSetLinkedNode
.
event
,
this
.
_onDidLinkedWidthNodeChange
.
event
,
this
.
_onDidLinkedHeightNodeChange
.
event
);
}
get
width
():
number
{
...
...
@@ -346,24 +402,36 @@ class LeafNode implements ISplitView, IDisposable {
return
this
.
view
.
element
;
}
private
get
minimumWidth
():
number
{
return
this
.
linkedWidthNode
?
Math
.
max
(
this
.
linkedWidthNode
.
view
.
minimumWidth
,
this
.
view
.
minimumWidth
)
:
this
.
view
.
minimumWidth
;
}
private
get
maximumWidth
():
number
{
return
this
.
linkedWidthNode
?
Math
.
min
(
this
.
linkedWidthNode
.
view
.
maximumWidth
,
this
.
view
.
maximumWidth
)
:
this
.
view
.
maximumWidth
;
}
private
get
minimumHeight
():
number
{
return
this
.
linkedHeightNode
?
Math
.
max
(
this
.
linkedHeightNode
.
view
.
minimumHeight
,
this
.
view
.
minimumHeight
)
:
this
.
view
.
minimumHeight
;
}
private
get
maximumHeight
():
number
{
return
this
.
linkedHeightNode
?
Math
.
min
(
this
.
linkedHeightNode
.
view
.
maximumHeight
,
this
.
view
.
maximumHeight
)
:
this
.
view
.
maximumHeight
;
}
get
minimumSize
():
number
{
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
view
.
minimumHeight
:
this
.
view
.
minimumWidth
;
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
minimumHeight
:
this
.
minimumWidth
;
}
get
maximumSize
():
number
{
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
view
.
maximumHeight
:
this
.
view
.
maximumWidth
;
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
maximumHeight
:
this
.
maximumWidth
;
}
get
minimumOrthogonalSize
():
number
{
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
view
.
minimumWidth
:
this
.
view
.
minimumHeight
;
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
minimumWidth
:
this
.
minimumHeight
;
}
get
maximumOrthogonalSize
():
number
{
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
view
.
maximumWidth
:
this
.
view
.
maximumHeight
;
}
get
onDidChange
():
Event
<
number
>
{
return
mapEvent
(
this
.
view
.
onDidChange
,
this
.
orientation
===
Orientation
.
HORIZONTAL
?
e
=>
e
&&
e
.
width
:
e
=>
e
&&
e
.
height
);
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
maximumWidth
:
this
.
maximumHeight
;
}
set
orthogonalStartSash
(
sash
:
Sash
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录