Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8b453ea8
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
8b453ea8
编写于
6月 12, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid.maximizeViewSize, grid.distributeViewSizes
fixes #50947
上级
dee27453
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
38 deletion
+41
-38
src/vs/base/browser/ui/grid/grid.ts
src/vs/base/browser/ui/grid/grid.ts
+7
-10
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+31
-6
src/vs/base/test/browser/ui/grid/grid.test.ts
src/vs/base/test/browser/ui/grid/grid.test.ts
+0
-6
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+3
-16
未找到文件。
src/vs/base/browser/ui/grid/grid.ts
浏览文件 @
8b453ea8
...
...
@@ -280,20 +280,17 @@ export class Grid<T extends IView> implements IDisposable {
return
getLocationOrientation
(
this
.
orientation
,
location
)
===
Orientation
.
HORIZONTAL
?
viewSize
.
width
:
viewSize
.
height
;
}
getViews
():
GridBranchNode
<
T
>
{
return
this
.
gridview
.
getViews
()
as
GridBranchNode
<
T
>
;
}
getOrientation
(
view
:
T
):
Orientation
{
maximizeViewSize
(
view
:
T
):
void
{
const
location
=
this
.
getViewLocation
(
view
);
return
getLocationOrientation
(
this
.
orientation
,
location
);
this
.
gridview
.
maximizeViewSize
(
location
);
}
resetViewSize
(
view
:
T
):
void
{
const
location
=
this
.
getViewLocation
(
view
);
distributeViewSizes
():
void
{
this
.
gridview
.
distributeViewSizes
();
}
this
.
doResetViewSize
(
location
);
getViews
():
GridBranchNode
<
T
>
{
return
this
.
gridview
.
getViews
()
as
GridBranchNode
<
T
>
;
}
getNeighborViews
(
view
:
T
,
direction
:
Direction
,
wrap
:
boolean
=
false
):
T
[]
{
...
...
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
8b453ea8
...
...
@@ -256,8 +256,16 @@ class BranchNode implements ISplitView, IDisposable {
this
.
splitview
.
resizeView
(
index
,
size
);
}
distributeViewSizes
():
void
{
distributeViewSizes
(
recursive
=
false
):
void
{
this
.
splitview
.
distributeViewSizes
();
if
(
recursive
)
{
for
(
const
child
of
this
.
children
)
{
if
(
child
instanceof
BranchNode
)
{
child
.
distributeViewSizes
(
true
);
}
}
}
}
getChildSize
(
index
:
number
):
number
{
...
...
@@ -622,19 +630,36 @@ export class GridView implements IDisposable {
parent
.
resizeChild
(
index
,
size
);
}
distributeViewSizes
(
location
:
number
[]):
void
{
getViewSize
(
location
:
number
[]):
{
width
:
number
;
height
:
number
;
}
{
const
[,
node
]
=
this
.
getNode
(
location
);
return
{
width
:
node
.
width
,
height
:
node
.
height
};
}
if
(
!
(
node
instanceof
BranchNode
))
{
maximizeViewSize
(
location
:
number
[]):
void
{
const
[
ancestors
,
node
]
=
this
.
getNode
(
location
);
if
(
!
(
node
instanceof
LeafNode
))
{
throw
new
Error
(
'
Invalid location
'
);
}
node
.
distributeViewSizes
();
for
(
let
i
=
0
;
i
<
ancestors
.
length
;
i
++
)
{
ancestors
[
i
].
resizeChild
(
location
[
i
],
Number
.
POSITIVE_INFINITY
);
}
}
getViewSize
(
location
:
number
[]):
{
width
:
number
;
height
:
number
;
}
{
distributeViewSizes
(
location
?:
number
[]):
void
{
if
(
!
location
)
{
this
.
root
.
distributeViewSizes
(
true
);
return
;
}
const
[,
node
]
=
this
.
getNode
(
location
);
return
{
width
:
node
.
width
,
height
:
node
.
height
};
if
(
!
(
node
instanceof
BranchNode
))
{
throw
new
Error
(
'
Invalid location
'
);
}
node
.
distributeViewSizes
();
}
getViews
():
GridBranchNode
{
...
...
src/vs/base/test/browser/ui/grid/grid.test.ts
浏览文件 @
8b453ea8
...
...
@@ -72,9 +72,6 @@ suite('Grid', function () {
grid
.
addView
(
view2
,
200
,
view1
,
Direction
.
Up
);
assert
.
deepEqual
(
view1
.
size
,
[
800
,
400
]);
assert
.
deepEqual
(
view2
.
size
,
[
800
,
200
]);
assert
.
equal
(
grid
.
getOrientation
(
view1
),
Orientation
.
VERTICAL
);
assert
.
equal
(
grid
.
getOrientation
(
view2
),
Orientation
.
VERTICAL
);
});
test
(
'
two views horizontally
'
,
function
()
{
...
...
@@ -87,9 +84,6 @@ suite('Grid', function () {
grid
.
addView
(
view2
,
300
,
view1
,
Direction
.
Right
);
assert
.
deepEqual
(
view1
.
size
,
[
500
,
600
]);
assert
.
deepEqual
(
view2
.
size
,
[
300
,
600
]);
assert
.
equal
(
grid
.
getOrientation
(
view1
),
Orientation
.
HORIZONTAL
);
assert
.
equal
(
grid
.
getOrientation
(
view2
),
Orientation
.
HORIZONTAL
);
});
test
(
'
simple layout
'
,
function
()
{
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
8b453ea8
...
...
@@ -18,7 +18,7 @@ import { GroupIdentifier, IWorkbenchEditorConfiguration } from 'vs/workbench/com
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
EDITOR_GROUP_BORDER
}
from
'
vs/workbench/common/theme
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
IEditorGroupsAccessor
,
IEditorGroupView
,
IEditorPartOptions
,
getEditorPartOptions
,
impactsEditorPartOptions
,
IEditorPartOptionsChangeEvent
,
E
DITOR_MAX_DIMENSIONS
,
EDITOR_MIN_DIMENSIONS
,
E
ditorGroupsServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditorGroupsAccessor
,
IEditorGroupView
,
IEditorPartOptions
,
getEditorPartOptions
,
impactsEditorPartOptions
,
IEditorPartOptionsChangeEvent
,
EditorGroupsServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
EditorGroupView
}
from
'
vs/workbench/browser/parts/editor/editorGroupView
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -294,25 +294,12 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
// Even all group sizes
if
(
arrangement
===
GroupsArrangement
.
EVEN
)
{
this
.
groups
.
forEach
(
group
=>
{
this
.
gridWidget
.
resetViewSize
(
group
);
});
this
.
gridWidget
.
distributeViewSizes
();
}
// Maximize the current active group
else
{
this
.
groups
.
forEach
(
group
=>
{
const
orientation
=
this
.
gridWidget
.
getOrientation
(
group
);
let
newSize
:
number
;
if
(
this
.
activeGroup
===
group
)
{
newSize
=
orientation
===
Orientation
.
HORIZONTAL
?
EDITOR_MAX_DIMENSIONS
.
width
:
EDITOR_MAX_DIMENSIONS
.
height
;
}
else
{
newSize
=
orientation
===
Orientation
.
HORIZONTAL
?
EDITOR_MIN_DIMENSIONS
.
width
:
EDITOR_MIN_DIMENSIONS
.
height
;
}
this
.
gridWidget
.
resizeView
(
group
,
newSize
);
});
this
.
gridWidget
.
maximizeViewSize
(
this
.
activeGroup
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录