Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2d4bf2d7
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,发现更多精彩内容 >>
提交
2d4bf2d7
编写于
5月 09, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - implement resize() functionality
上级
a970588e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
14 deletion
+39
-14
src/vs/base/browser/ui/grid/grid.ts
src/vs/base/browser/ui/grid/grid.ts
+6
-0
src/vs/base/test/browser/ui/grid/grid.test.ts
src/vs/base/test/browser/ui/grid/grid.test.ts
+6
-0
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+7
-6
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+4
-8
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
+11
-0
src/vs/workbench/services/group/common/nextEditorGroupsService.ts
...orkbench/services/group/common/nextEditorGroupsService.ts
+5
-0
未找到文件。
src/vs/base/browser/ui/grid/grid.ts
浏览文件 @
2d4bf2d7
...
...
@@ -196,6 +196,12 @@ export class Grid<T extends IView> implements IDisposable {
return
this
.
gridview
.
getViews
()
as
GridBranchNode
<
T
>
;
}
getOrientation
(
view
:
T
):
Orientation
{
const
location
=
this
.
getViewLocation
(
view
);
return
getLocationOrientation
(
this
.
orientation
,
location
);
}
private
getViewLocation
(
view
:
T
):
number
[]
{
const
element
=
this
.
views
.
get
(
view
);
...
...
src/vs/base/test/browser/ui/grid/grid.test.ts
浏览文件 @
2d4bf2d7
...
...
@@ -71,6 +71,9 @@ 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
()
{
...
...
@@ -83,6 +86,9 @@ 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/layout.ts
浏览文件 @
2d4bf2d7
...
...
@@ -23,6 +23,7 @@ import { memoize } from 'vs/base/common/decorators';
import
{
NotificationsCenter
}
from
'
vs/workbench/browser/parts/notifications/notificationsCenter
'
;
import
{
NotificationsToasts
}
from
'
vs/workbench/browser/parts/notifications/notificationsToasts
'
;
import
{
Dimension
,
getClientArea
,
size
,
position
,
hide
,
show
}
from
'
vs/base/browser/dom
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
const
MIN_SIDEBAR_PART_WIDTH
=
170
;
const
DEFAULT_SIDEBAR_PART_WIDTH
=
300
;
...
...
@@ -108,7 +109,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IPartService
private
partService
:
IPartService
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IThemeService
themeService
:
IThemeService
@
IThemeService
themeService
:
IThemeService
,
@
INextEditorGroupsService
private
nextEditorGroupsService
:
INextEditorGroupsService
)
{
this
.
parent
=
parent
;
this
.
workbenchContainer
=
workbenchContainer
;
...
...
@@ -153,11 +155,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
}
private
get
editorCountForHeight
():
number
{
return
Math
.
max
(
1
,
this
.
editorGroupService
.
getGroupOrientation
()
===
'
horizontal
'
?
this
.
editorGroupService
.
getStacksModel
().
groups
.
length
:
1
);
return
this
.
nextEditorGroupsService
.
count
;
/* TODO@grid revisit */
}
private
get
editorCountForWidth
():
number
{
return
Math
.
max
(
1
,
this
.
editorGroupService
.
getGroupOrientation
()
===
'
vertical
'
?
this
.
editorGroupService
.
getStacksModel
().
groups
.
length
:
1
);
return
this
.
nextEditorGroupsService
.
count
;
/* TODO@grid revisit */
}
private
get
activitybarWidth
():
number
{
...
...
@@ -781,10 +783,9 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
}
}
else
{
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
const
activeGroup
=
stacks
.
positionOfGroup
(
stacks
.
activeGroup
);
const
activeGroup
=
this
.
nextEditorGroupsService
.
activeGroup
;
this
.
editorGroup
Service
.
resizeGroup
(
activeGroup
,
sizeChangePxWidth
);
this
.
nextEditorGroups
Service
.
resizeGroup
(
activeGroup
,
sizeChangePxWidth
);
doLayout
=
false
;
}
}
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
2d4bf2d7
...
...
@@ -312,14 +312,6 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
//#endregion
//#region TODO@grid resizeGroup()
public
resizeGroup
(
position
:
Position
,
groupSizeChange
:
number
):
void
{
this
.
editorGroupsControl
.
resizeGroup
(
position
,
groupSizeChange
);
}
//#endregion
//#region TODO@grid group orientation
public
get
onGroupOrientationChanged
():
Event
<
void
>
{
...
...
@@ -535,6 +527,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return
this
.
doOpenEditors
(
editors
,
activePosition
,
ratio
,
sideBySide
);
}
public
resizeGroup
(
position
:
Position
,
groupSizeChange
:
number
):
void
{
this
.
editorGroupsControl
.
resizeGroup
(
position
,
groupSizeChange
);
}
private
doOpenEditors
(
editors
:
{
input
:
EditorInput
,
position
?:
Position
,
options
?:
EditorOptions
}[],
activePosition
?:
number
,
ratio
?:
number
[],
sideBySide
?:
boolean
):
TPromise
<
IEditor
[]
>
{
// Find position if not provided already from calling side
...
...
src/vs/workbench/browser/parts/editor2/nextEditorPart.ts
浏览文件 @
2d4bf2d7
...
...
@@ -194,6 +194,17 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
return
groupView
;
}
resizeGroup
(
group
:
INextEditorGroupView
|
GroupIdentifier
,
sizeDelta
:
number
):
INextEditorGroupView
{
const
groupView
=
this
.
assertGroupView
(
group
);
const
currentSize
=
this
.
gridWidget
.
getViewSize
(
groupView
);
const
currentOrientation
=
this
.
gridWidget
.
getOrientation
(
groupView
);
this
.
gridWidget
.
resizeView
(
groupView
,
currentOrientation
===
Orientation
.
HORIZONTAL
?
currentSize
.
width
+
sizeDelta
:
currentSize
.
height
+
sizeDelta
);
return
groupView
;
}
addGroup
(
location
:
INextEditorGroupView
|
GroupIdentifier
,
direction
:
GroupDirection
,
options
?:
IAddGroupOptions
):
INextEditorGroupView
{
const
locationView
=
this
.
assertGroupView
(
location
);
...
...
src/vs/workbench/services/group/common/nextEditorGroupsService.ts
浏览文件 @
2d4bf2d7
...
...
@@ -93,6 +93,11 @@ export interface INextEditorGroupsService {
*/
activateGroup
(
group
:
INextEditorGroup
|
GroupIdentifier
):
INextEditorGroup
;
/**
* Resize the group given the provided size delta.
*/
resizeGroup
(
group
:
INextEditorGroup
|
GroupIdentifier
,
sizeDelta
:
number
):
INextEditorGroup
;
/**
* Add a new group to the editor area. A new group is added by splitting a provided one in
* one of the four directions.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录