Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7ca5eb10
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ca5eb10
编写于
4月 27, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid: size changes
上级
db3d9531
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
19 deletion
+37
-19
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+31
-15
test/grid.html
test/grid.html
+6
-4
未找到文件。
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
7ca5eb10
...
...
@@ -69,10 +69,12 @@ function tail<T>(arr: T[]): [T[], T] {
abstract
class
AbstractNode
implements
ISplitView
{
abstract
minimumSize
:
number
;
abstract
maximumSize
:
number
;
readonly
orientation
:
Orientation
;
abstract
readonly
minimumSize
:
number
;
abstract
readonly
maximumSize
:
number
;
abstract
readonly
onDidChange
:
Event
<
number
>
;
abstract
onDidChange
:
Event
<
number
>
;
abstract
render
(
container
:
HTMLElement
):
void
;
private
_size
:
number
|
undefined
;
...
...
@@ -81,7 +83,8 @@ abstract class AbstractNode implements ISplitView {
private
_orthogonalSize
:
number
|
undefined
;
get
orthogonalSize
():
number
|
undefined
{
return
this
.
_orthogonalSize
;
}
constructor
(
size
?:
number
,
orthogonalSize
?:
number
)
{
constructor
(
orientation
:
Orientation
,
size
?:
number
,
orthogonalSize
?:
number
)
{
this
.
orientation
=
orientation
;
this
.
_size
=
size
;
this
.
_orthogonalSize
=
orthogonalSize
;
}
...
...
@@ -101,7 +104,6 @@ class BranchNode<T extends IView> extends AbstractNode {
readonly
children
:
Node
<
T
>
[];
private
splitview
:
SplitView
;
readonly
orientation
:
Orientation
;
get
minimumSize
():
number
{
let
result
=
0
;
...
...
@@ -140,9 +142,8 @@ class BranchNode<T extends IView> extends AbstractNode {
private
onDidChangeDisposable
:
IDisposable
;
constructor
(
orientation
:
Orientation
,
size
?:
number
,
orthogonalSize
?:
number
)
{
super
(
size
,
orthogonalSize
);
super
(
orientation
,
size
,
orthogonalSize
);
this
.
orientation
=
orientation
;
this
.
_onDidChange
=
new
Emitter
<
number
|
undefined
>
();
this
.
children
=
[];
this
.
onDidChangeDisposable
=
EmptyDisposable
;
...
...
@@ -224,12 +225,22 @@ class BranchNode<T extends IView> extends AbstractNode {
class
LeafNode
<
T
extends
IView
>
extends
AbstractNode
{
constructor
(
readonly
view
:
T
,
orthogonalSize
:
number
)
{
super
(
undefined
,
orthogonalSize
);
constructor
(
readonly
view
:
T
,
orientation
:
Orientation
,
orthogonalSize
:
number
)
{
super
(
orientation
,
undefined
,
orthogonalSize
);
}
get
minimumSize
():
number
{
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
view
.
minimumHeight
:
this
.
view
.
minimumWidth
;
}
get
maximumSize
():
number
{
return
this
.
orientation
===
Orientation
.
HORIZONTAL
?
this
.
view
.
maximumHeight
:
this
.
view
.
maximumWidth
;
}
get
minimumSize
():
number
{
return
/* this.view.minimumSize */
20
;
}
get
maximumSize
():
number
{
return
/* this.view.maximumSize */
Number
.
MAX_VALUE
;
}
get
onDidChange
():
Event
<
number
>
{
return
this
.
view
.
onDidChange
;
}
render
(
container
:
HTMLElement
):
void
{
...
...
@@ -238,7 +249,12 @@ class LeafNode<T extends IView> extends AbstractNode {
layout
(
size
:
number
):
void
{
super
.
layout
(
size
);
return
this
.
view
.
layout
(
size
,
void
0
);
const
[
width
,
height
]
=
this
.
orientation
===
Orientation
.
HORIZONTAL
?
[
this
.
orthogonalSize
,
this
.
size
]
:
[
this
.
size
,
this
.
orthogonalSize
];
return
this
.
view
.
layout
(
width
,
height
);
}
}
...
...
@@ -259,7 +275,7 @@ export class GridView<T extends IView> implements IGrid<T>, IDisposable {
const
[
pathToParent
,
parent
]
=
this
.
getNode
(
rest
);
if
(
parent
instanceof
BranchNode
)
{
const
node
=
new
LeafNode
<
T
>
(
view
,
parent
.
size
);
const
node
=
new
LeafNode
<
T
>
(
view
,
orthogonal
(
parent
.
orientation
),
parent
.
size
);
parent
.
addChild
(
node
,
size
,
index
);
}
else
{
const
[,
grandParent
]
=
tail
(
pathToParent
);
...
...
@@ -272,10 +288,10 @@ export class GridView<T extends IView> implements IGrid<T>, IDisposable {
grandParent
.
addChild
(
newParent
,
parent
.
size
,
parentIndex
);
newParent
.
layout
(
parent
.
orthogonalSize
);
const
newSibling
=
new
LeafNode
<
T
>
(
parent
.
view
,
parent
.
size
);
const
newSibling
=
new
LeafNode
<
T
>
(
parent
.
view
,
grandParent
.
orientation
,
parent
.
size
);
newParent
.
addChild
(
newSibling
,
Number
.
MAX_VALUE
,
0
);
const
node
=
new
LeafNode
<
T
>
(
view
,
parent
.
size
);
const
node
=
new
LeafNode
<
T
>
(
view
,
grandParent
.
orientation
,
parent
.
size
);
newParent
.
addChild
(
node
,
size
,
index
);
}
}
...
...
test/grid.html
浏览文件 @
7ca5eb10
...
...
@@ -42,11 +42,13 @@
let
element
;
return
{
ID
:
`
${
id
}
`
,
minimumSize
:
20
,
maximumSize
:
Number
.
POSITIVE_INFINITY
,
minimumWidth
:
20
,
maximumWidth
:
Number
.
POSITIVE_INFINITY
,
minimumHeight
:
20
,
maximumHeight
:
Number
.
POSITIVE_INFINITY
,
onDidChange
:
Event
.
None
,
layout
(
size
)
{
element
.
textContent
=
`hello
${
id
}
(
${
size
}
)`
layout
(
width
,
height
)
{
element
.
textContent
=
`hello
${
id
}
(
${
width
}
,
${
height
}
)`
},
render
(
el
)
{
element
=
el
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录