Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
ee1ab9fe
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,发现更多精彩内容 >>
提交
ee1ab9fe
编写于
6月 07, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
multi sash resize groundwork
上级
c943a9e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
145 addition
and
10 deletion
+145
-10
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+18
-2
src/vs/base/browser/ui/sash/sash.css
src/vs/base/browser/ui/sash/sash.css
+31
-1
src/vs/base/browser/ui/sash/sash.ts
src/vs/base/browser/ui/sash/sash.ts
+53
-0
src/vs/base/browser/ui/splitview/splitview.css
src/vs/base/browser/ui/splitview/splitview.css
+8
-2
src/vs/base/browser/ui/splitview/splitview.ts
src/vs/base/browser/ui/splitview/splitview.ts
+35
-5
未找到文件。
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
ee1ab9fe
...
...
@@ -7,7 +7,7 @@
import
'
vs/css!./gridview
'
;
import
{
Event
,
anyEvent
,
Emitter
,
mapEvent
,
Relay
}
from
'
vs/base/common/event
'
;
import
{
Orientation
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
Orientation
,
Sash
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
SplitView
,
IView
as
ISplitView
,
Sizing
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
empty
as
EmptyDisposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
$
,
append
}
from
'
vs/base/browser/dom
'
;
...
...
@@ -122,6 +122,11 @@ class BranchNode implements ISplitView, IDisposable {
private
splitviewSashResetDisposable
:
IDisposable
=
EmptyDisposable
;
private
childrenSashResetDisposable
:
IDisposable
=
EmptyDisposable
;
get
orthogonalStartSash
():
Sash
|
undefined
{
return
this
.
splitview
.
orthogonalStartSash
;
}
set
orthogonalStartSash
(
sash
:
Sash
|
undefined
)
{
this
.
splitview
.
orthogonalStartSash
=
sash
;
}
get
orthogonalEndSash
():
Sash
|
undefined
{
return
this
.
splitview
.
orthogonalEndSash
;
}
set
orthogonalEndSash
(
sash
:
Sash
|
undefined
)
{
this
.
splitview
.
orthogonalEndSash
=
sash
;
}
constructor
(
readonly
orientation
:
Orientation
,
size
:
number
=
0
,
...
...
@@ -134,7 +139,7 @@ class BranchNode implements ISplitView, IDisposable {
this
.
children
=
[];
this
.
element
=
$
(
'
.monaco-grid-branch-node
'
);
this
.
splitview
=
new
SplitView
(
this
.
element
,
{
orientation
:
this
.
orientation
});
this
.
splitview
=
new
SplitView
(
this
.
element
,
{
orientation
});
this
.
splitview
.
layout
(
size
);
const
onDidSashReset
=
mapEvent
(
this
.
splitview
.
onDidSashReset
,
i
=>
[
i
]);
...
...
@@ -161,6 +166,8 @@ class BranchNode implements ISplitView, IDisposable {
this
.
splitview
.
addView
(
node
,
size
,
index
);
this
.
children
.
splice
(
index
,
0
,
node
);
node
.
orthogonalStartSash
=
this
.
splitview
.
sashes
[
index
-
1
];
node
.
orthogonalEndSash
=
this
.
splitview
.
sashes
[
index
];
this
.
onDidChildrenChange
();
}
...
...
@@ -188,6 +195,7 @@ class BranchNode implements ISplitView, IDisposable {
}
this
.
splitview
.
swapViews
(
from
,
to
);
[
this
.
children
[
from
].
orthogonalStartSash
,
this
.
children
[
from
].
orthogonalEndSash
,
this
.
children
[
to
].
orthogonalStartSash
,
this
.
children
[
to
].
orthogonalEndSash
]
=
[
this
.
children
[
to
].
orthogonalStartSash
,
this
.
children
[
to
].
orthogonalEndSash
,
this
.
children
[
from
].
orthogonalStartSash
,
this
.
children
[
from
].
orthogonalEndSash
];
[
this
.
children
[
from
],
this
.
children
[
to
]]
=
[
this
.
children
[
to
],
this
.
children
[
from
]];
}
...
...
@@ -285,6 +293,14 @@ class LeafNode implements ISplitView, IDisposable {
return
mapEvent
(
this
.
view
.
onDidChange
,
this
.
orientation
===
Orientation
.
HORIZONTAL
?
({
width
})
=>
width
:
({
height
})
=>
height
);
}
set
orthogonalStartSash
(
sash
:
Sash
)
{
// noop
}
set
orthogonalEndSash
(
sash
:
Sash
)
{
// noop
}
layout
(
size
:
number
):
void
{
this
.
_size
=
size
;
return
this
.
view
.
layout
(
this
.
width
,
this
.
height
);
...
...
src/vs/base/browser/ui/sash/sash.css
浏览文件 @
ee1ab9fe
...
...
@@ -14,6 +14,35 @@
top
:
0
;
width
:
5px
;
height
:
100%
;
background
:
red
;
}
.monaco-sash.orthogonal-start
::before
,
.monaco-sash.orthogonal-end
::after
{
content
:
' '
;
height
:
5px
;
width
:
5px
;
background
:
green
;
z-index
:
100
;
display
:
block
;
cursor
:
all-scroll
;
position
:
absolute
;
}
.monaco-sash.orthogonal-start.vertical
::before
{
top
:
-2.5px
;
}
.monaco-sash.orthogonal-end.vertical
::after
{
bottom
:
-2.5px
;
}
.monaco-sash.orthogonal-start.horizontal
::before
{
left
:
-2.5px
;
}
.monaco-sash.orthogonal-end.horizontal
::after
{
right
:
-2.5px
;
}
.monaco-sash.horizontal
{
...
...
@@ -21,6 +50,7 @@
left
:
0
;
width
:
100%
;
height
:
5px
;
background
:
blue
;
}
.monaco-sash.disabled
{
...
...
@@ -45,4 +75,4 @@
.monaco-sash.touch.horizontal
{
height
:
20px
;
}
\ No newline at end of file
}
src/vs/base/browser/ui/sash/sash.ts
浏览文件 @
ee1ab9fe
...
...
@@ -40,6 +40,8 @@ export interface ISashEvent {
export
interface
ISashOptions
{
orientation
?:
Orientation
;
orthogonalStartSash
?:
Sash
;
orthogonalEndSash
?:
Sash
;
}
export
enum
Orientation
{
...
...
@@ -84,6 +86,38 @@ export class Sash {
private
readonly
_onDidEnd
=
new
Emitter
<
void
>
();
readonly
onDidEnd
:
Event
<
void
>
=
this
.
_onDidEnd
.
event
;
private
orthogonalStartSashDisposables
:
IDisposable
[]
=
[];
private
_orthogonalStartSash
:
Sash
|
undefined
;
get
orthogonalStartSash
():
Sash
|
undefined
{
return
this
.
_orthogonalStartSash
;
}
set
orthogonalStartSash
(
sash
:
Sash
|
undefined
)
{
this
.
orthogonalStartSashDisposables
=
dispose
(
this
.
orthogonalStartSashDisposables
);
if
(
sash
)
{
sash
.
onDidEnablementChange
(
this
.
onOrthogonalStartSashEnablementChange
,
this
,
this
.
orthogonalStartSashDisposables
);
this
.
onOrthogonalStartSashEnablementChange
(
sash
.
enabled
);
}
else
{
this
.
onOrthogonalStartSashEnablementChange
(
false
);
}
this
.
_orthogonalStartSash
=
sash
;
}
private
orthogonalEndSashDisposables
:
IDisposable
[]
=
[];
private
_orthogonalEndSash
:
Sash
|
undefined
;
get
orthogonalEndSash
():
Sash
|
undefined
{
return
this
.
_orthogonalEndSash
;
}
set
orthogonalEndSash
(
sash
:
Sash
|
undefined
)
{
this
.
orthogonalEndSashDisposables
=
dispose
(
this
.
orthogonalEndSashDisposables
);
if
(
sash
)
{
sash
.
onDidEnablementChange
(
this
.
onOrthogonalEndSashEnablementChange
,
this
,
this
.
orthogonalEndSashDisposables
);
this
.
onOrthogonalEndSashEnablementChange
(
sash
.
enabled
);
}
else
{
this
.
onOrthogonalEndSashEnablementChange
(
false
);
}
this
.
_orthogonalEndSash
=
sash
;
}
constructor
(
container
:
HTMLElement
,
layoutProvider
:
ISashLayoutProvider
,
options
:
ISashOptions
=
{})
{
this
.
el
=
append
(
container
,
$
(
'
.monaco-sash
'
));
...
...
@@ -106,6 +140,9 @@ export class Sash {
this
.
hidden
=
false
;
this
.
layoutProvider
=
layoutProvider
;
this
.
orthogonalStartSash
=
options
.
orthogonalStartSash
;
this
.
orthogonalEndSash
=
options
.
orthogonalEndSash
;
}
setOrientation
(
orientation
:
Orientation
):
void
{
...
...
@@ -281,6 +318,22 @@ export class Sash {
return
this
.
hidden
;
}
private
onOrthogonalStartSashEnablementChange
(
enabled
:
boolean
):
void
{
if
(
enabled
)
{
addClass
(
this
.
el
,
'
orthogonal-start
'
);
}
else
{
removeClass
(
this
.
el
,
'
orthogonal-start
'
);
}
}
private
onOrthogonalEndSashEnablementChange
(
enabled
:
boolean
):
void
{
if
(
enabled
)
{
addClass
(
this
.
el
,
'
orthogonal-end
'
);
}
else
{
removeClass
(
this
.
el
,
'
orthogonal-end
'
);
}
}
dispose
():
void
{
if
(
this
.
el
&&
this
.
el
.
parentElement
)
{
this
.
el
.
parentElement
.
removeChild
(
this
.
el
);
...
...
src/vs/base/browser/ui/splitview/splitview.css
浏览文件 @
ee1ab9fe
...
...
@@ -5,7 +5,13 @@
.monaco-split-view2
{
position
:
relative
;
overflow
:
hidden
;
/* overflow: hidden; */
width
:
100%
;
height
:
100%
;
}
.monaco-split-view2
>
.sash-container
{
position
:
absolute
;
width
:
100%
;
height
:
100%
;
}
...
...
@@ -17,7 +23,7 @@
}
.monaco-split-view2
>
.split-view-container
>
.split-view-view
{
overflow
:
hidden
;
/* overflow: hidden; */
white-space
:
initial
;
}
...
...
src/vs/base/browser/ui/splitview/splitview.ts
浏览文件 @
ee1ab9fe
...
...
@@ -17,6 +17,8 @@ export { Orientation } from 'vs/base/browser/ui/sash/sash';
export
interface
ISplitViewOptions
{
orientation
?:
Orientation
;
// default Orientation.VERTICAL
orthogonalStartSash
?:
Sash
;
orthogonalEndSash
?:
Sash
;
}
export
interface
IView
{
...
...
@@ -107,8 +109,9 @@ export namespace Sizing {
export
class
SplitView
implements
IDisposable
{
private
orientation
:
Orientation
;
readonly
orientation
:
Orientation
;
private
el
:
HTMLElement
;
private
sashContainer
:
HTMLElement
;
private
viewContainer
:
HTMLElement
;
private
size
=
0
;
private
contentSize
=
0
;
...
...
@@ -126,6 +129,30 @@ export class SplitView implements IDisposable {
return
this
.
viewItems
.
length
;
}
private
_orthogonalStartSash
:
Sash
|
undefined
;
get
orthogonalStartSash
():
Sash
|
undefined
{
return
this
.
_orthogonalStartSash
;
}
set
orthogonalStartSash
(
sash
:
Sash
|
undefined
)
{
for
(
const
sashItem
of
this
.
sashItems
)
{
sashItem
.
sash
.
orthogonalStartSash
=
sash
;
}
this
.
_orthogonalStartSash
=
sash
;
}
private
_orthogonalEndSash
:
Sash
|
undefined
;
get
orthogonalEndSash
():
Sash
|
undefined
{
return
this
.
_orthogonalEndSash
;
}
set
orthogonalEndSash
(
sash
:
Sash
|
undefined
)
{
for
(
const
sashItem
of
this
.
sashItems
)
{
sashItem
.
sash
.
orthogonalEndSash
=
sash
;
}
this
.
_orthogonalEndSash
=
sash
;
}
get
sashes
():
Sash
[]
{
return
this
.
sashItems
.
map
(
s
=>
s
.
sash
);
}
constructor
(
container
:
HTMLElement
,
options
:
ISplitViewOptions
=
{})
{
this
.
orientation
=
types
.
isUndefined
(
options
.
orientation
)
?
Orientation
.
VERTICAL
:
options
.
orientation
;
...
...
@@ -134,9 +161,8 @@ export class SplitView implements IDisposable {
dom
.
addClass
(
this
.
el
,
this
.
orientation
===
Orientation
.
VERTICAL
?
'
vertical
'
:
'
horizontal
'
);
container
.
appendChild
(
this
.
el
);
this
.
viewContainer
=
document
.
createElement
(
'
div
'
);
dom
.
addClass
(
this
.
viewContainer
,
'
split-view-container
'
);
this
.
el
.
appendChild
(
this
.
viewContainer
);
this
.
sashContainer
=
dom
.
append
(
this
.
el
,
dom
.
$
(
'
.sash-container
'
));
this
.
viewContainer
=
dom
.
append
(
this
.
el
,
dom
.
$
(
'
.split-view-container
'
));
}
addView
(
view
:
IView
,
size
:
number
|
Sizing
,
index
=
this
.
viewItems
.
length
):
void
{
...
...
@@ -185,7 +211,11 @@ export class SplitView implements IDisposable {
if
(
this
.
viewItems
.
length
>
1
)
{
const
orientation
=
this
.
orientation
===
Orientation
.
VERTICAL
?
Orientation
.
HORIZONTAL
:
Orientation
.
VERTICAL
;
const
layoutProvider
=
this
.
orientation
===
Orientation
.
VERTICAL
?
{
getHorizontalSashTop
:
sash
=>
this
.
getSashPosition
(
sash
)
}
:
{
getVerticalSashLeft
:
sash
=>
this
.
getSashPosition
(
sash
)
};
const
sash
=
new
Sash
(
this
.
el
,
layoutProvider
,
{
orientation
});
const
sash
=
new
Sash
(
this
.
sashContainer
,
layoutProvider
,
{
orientation
,
orthogonalStartSash
:
this
.
orthogonalStartSash
,
orthogonalEndSash
:
this
.
orthogonalEndSash
});
const
sashEventMapper
=
this
.
orientation
===
Orientation
.
VERTICAL
?
(
e
:
IBaseSashEvent
)
=>
({
sash
,
start
:
e
.
startY
,
current
:
e
.
currentY
})
:
(
e
:
IBaseSashEvent
)
=>
({
sash
,
start
:
e
.
startX
,
current
:
e
.
currentX
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录