Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c9a0382f
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,发现更多精彩内容 >>
提交
c9a0382f
编写于
9月 20, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #55313
上级
941c0e56
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
15 deletion
+67
-15
src/vs/base/browser/ui/grid/grid.ts
src/vs/base/browser/ui/grid/grid.ts
+17
-5
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+49
-8
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+1
-2
未找到文件。
src/vs/base/browser/ui/grid/grid.ts
浏览文件 @
c9a0382f
...
...
@@ -8,7 +8,7 @@
import
'
vs/css!./gridview
'
;
import
{
Orientation
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
tail2
as
tail
}
from
'
vs/base/common/arrays
'
;
import
{
tail2
as
tail
,
equals
}
from
'
vs/base/common/arrays
'
;
import
{
orthogonal
,
IView
,
GridView
,
Sizing
as
GridViewSizing
,
Box
,
IGridViewStyles
}
from
'
./gridview
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
...
...
@@ -256,15 +256,27 @@ export class Grid<T extends IView> implements IDisposable {
throw
new
Error
(
'
Can
\'
t remove last view
'
);
}
if
(
!
this
.
views
.
has
(
view
))
{
throw
new
Error
(
'
View not found
'
);
}
const
location
=
this
.
getViewLocation
(
view
);
this
.
gridview
.
removeView
(
location
,
sizing
===
Sizing
.
Distribute
?
GridViewSizing
.
Distribute
:
undefined
);
this
.
views
.
delete
(
view
);
}
moveView
(
view
:
T
,
sizing
:
number
|
Sizing
,
referenceView
:
T
,
direction
:
Direction
):
void
{
const
sourceLocation
=
this
.
getViewLocation
(
view
);
const
[
sourceParentLocation
,
from
]
=
tail
(
sourceLocation
);
const
referenceLocation
=
this
.
getViewLocation
(
referenceView
);
const
targetLocation
=
getRelativeLocation
(
this
.
gridview
.
orientation
,
referenceLocation
,
direction
);
const
[
targetParentLocation
,
to
]
=
tail
(
targetLocation
);
if
(
equals
(
sourceParentLocation
,
targetParentLocation
))
{
this
.
gridview
.
moveView
(
sourceParentLocation
,
from
,
to
);
}
else
{
this
.
removeView
(
view
,
typeof
sizing
===
'
number
'
?
undefined
:
sizing
);
this
.
addView
(
view
,
sizing
,
referenceView
,
direction
);
}
}
swapViews
(
from
:
T
,
to
:
T
):
void
{
const
fromLocation
=
this
.
getViewLocation
(
from
);
const
toLocation
=
this
.
getViewLocation
(
to
);
...
...
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
c9a0382f
...
...
@@ -181,9 +181,14 @@ class BranchNode implements ISplitView, IDisposable {
throw
new
Error
(
'
Invalid index
'
);
}
const
first
=
index
===
0
;
const
last
=
index
===
this
.
splitview
.
length
;
this
.
splitview
.
addView
(
node
,
size
,
index
);
this
.
_addChild
(
node
,
index
);
this
.
onDidChildrenChange
();
}
private
_addChild
(
node
:
Node
,
index
:
number
):
void
{
const
first
=
index
===
0
;
const
last
=
index
===
this
.
children
.
length
;
this
.
children
.
splice
(
index
,
0
,
node
);
node
.
orthogonalStartSash
=
this
.
splitview
.
sashes
[
index
-
1
];
node
.
orthogonalEndSash
=
this
.
splitview
.
sashes
[
index
];
...
...
@@ -195,8 +200,6 @@ class BranchNode implements ISplitView, IDisposable {
if
(
!
last
)
{
this
.
children
[
index
+
1
].
orthogonalStartSash
=
this
.
splitview
.
sashes
[
index
];
}
this
.
onDidChildrenChange
();
}
removeChild
(
index
:
number
,
sizing
?:
Sizing
):
void
{
...
...
@@ -204,10 +207,15 @@ class BranchNode implements ISplitView, IDisposable {
throw
new
Error
(
'
Invalid index
'
);
}
const
first
=
index
===
0
;
const
last
=
index
===
this
.
splitview
.
length
-
1
;
this
.
splitview
.
removeView
(
index
,
sizing
);
this
.
children
.
splice
(
index
,
1
);
this
.
_removeChild
(
index
);
this
.
onDidChildrenChange
();
}
private
_removeChild
(
index
:
number
):
Node
{
const
first
=
index
===
0
;
const
last
=
index
===
this
.
children
.
length
-
1
;
const
[
child
]
=
this
.
children
.
splice
(
index
,
1
);
if
(
!
first
)
{
this
.
children
[
index
-
1
].
orthogonalEndSash
=
this
.
splitview
.
sashes
[
index
-
1
];
...
...
@@ -217,7 +225,30 @@ class BranchNode implements ISplitView, IDisposable {
this
.
children
[
index
].
orthogonalStartSash
=
this
.
splitview
.
sashes
[
Math
.
max
(
index
-
1
,
0
)];
}
this
.
onDidChildrenChange
();
return
child
;
}
moveChild
(
from
:
number
,
to
:
number
):
void
{
if
(
from
===
to
)
{
return
;
}
if
(
from
<
0
||
from
>=
this
.
children
.
length
)
{
throw
new
Error
(
'
Invalid from index
'
);
}
if
(
to
<
0
||
to
>
this
.
children
.
length
)
{
throw
new
Error
(
'
Invalid to index
'
);
}
if
(
from
<
to
)
{
to
--
;
}
this
.
splitview
.
moveView
(
from
,
to
);
const
child
=
this
.
_removeChild
(
from
);
this
.
_addChild
(
child
,
to
);
}
swapChildren
(
from
:
number
,
to
:
number
):
void
{
...
...
@@ -651,6 +682,16 @@ export class GridView implements IDisposable {
return
node
.
view
;
}
moveView
(
parentLocation
:
number
[],
from
:
number
,
to
:
number
):
void
{
const
[,
parent
]
=
this
.
getNode
(
parentLocation
);
if
(
!
(
parent
instanceof
BranchNode
))
{
throw
new
Error
(
'
Invalid location
'
);
}
parent
.
moveChild
(
from
,
to
);
}
swapViews
(
from
:
number
[],
to
:
number
[]):
void
{
const
[
fromRest
,
fromIndex
]
=
tail
(
from
);
const
[,
fromParent
]
=
this
.
getNode
(
fromRest
);
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
c9a0382f
...
...
@@ -661,8 +661,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
const
groupHasFocus
=
isAncestor
(
document
.
activeElement
,
sourceView
.
element
);
// Move is a simple remove and add of the same view
this
.
gridWidget
.
removeView
(
sourceView
,
Sizing
.
Distribute
);
this
.
gridWidget
.
addView
(
sourceView
,
Sizing
.
Distribute
,
targetView
,
this
.
toGridViewDirection
(
direction
));
this
.
gridWidget
.
moveView
(
sourceView
,
Sizing
.
Distribute
,
targetView
,
this
.
toGridViewDirection
(
direction
));
// Restore focus if we had it previously (we run this after gridWidget.removeView() is called
// because removing a view can mean to reparent it and thus focus would be removed otherwise)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录