Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b28471d1
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,发现更多精彩内容 >>
提交
b28471d1
编写于
9月 21, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
splitview: use preferred size in onDidChange
上级
1804467c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
9 deletion
+15
-9
src/vs/base/browser/ui/splitview/panelview.ts
src/vs/base/browser/ui/splitview/panelview.ts
+9
-4
src/vs/base/browser/ui/splitview/splitview2.ts
src/vs/base/browser/ui/splitview/splitview2.ts
+5
-4
src/vs/base/test/browser/ui/splitview/splitview.test.ts
src/vs/base/test/browser/ui/splitview/splitview.test.ts
+1
-1
未找到文件。
src/vs/base/browser/ui/splitview/panelview.ts
浏览文件 @
b28471d1
...
...
@@ -35,8 +35,8 @@ export abstract class Panel implements IView {
private
static
HEADER_SIZE
=
22
;
protected
_expanded
:
boolean
;
private
expandedSize
:
number
|
undefined
=
undefined
;
private
_headerVisible
=
true
;
private
_onDidChange
=
new
Emitter
<
void
>
();
private
_minimumBodySize
:
number
;
private
_maximumBodySize
:
number
;
private
ariaHeaderLabel
:
string
;
...
...
@@ -46,6 +46,9 @@ export abstract class Panel implements IView {
private
header
:
HTMLElement
;
protected
disposables
:
IDisposable
[]
=
[];
private
_onDidChange
=
new
Emitter
<
number
|
undefined
>
();
readonly
onDidChange
:
Event
<
number
|
undefined
>
=
this
.
_onDidChange
.
event
;
get
draggableElement
():
HTMLElement
{
return
this
.
header
;
}
...
...
@@ -97,8 +100,6 @@ export abstract class Panel implements IView {
return
headerSize
+
maximumBodySize
;
}
readonly
onDidChange
:
Event
<
void
>
=
this
.
_onDidChange
.
event
;
constructor
(
options
:
IPanelOptions
=
{})
{
this
.
_expanded
=
typeof
options
.
expanded
===
'
undefined
'
?
true
:
!!
options
.
expanded
;
this
.
ariaHeaderLabel
=
options
.
ariaHeaderLabel
||
''
;
...
...
@@ -117,7 +118,7 @@ export abstract class Panel implements IView {
this
.
_expanded
=
!!
expanded
;
this
.
updateHeader
();
this
.
_onDidChange
.
fire
();
this
.
_onDidChange
.
fire
(
expanded
?
this
.
expandedSize
:
undefined
);
}
get
headerVisible
():
boolean
{
...
...
@@ -179,6 +180,10 @@ export abstract class Panel implements IView {
layout
(
size
:
number
):
void
{
const
headerSize
=
this
.
headerVisible
?
Panel
.
HEADER_SIZE
:
0
;
this
.
layoutBody
(
size
-
headerSize
);
if
(
this
.
isExpanded
())
{
this
.
expandedSize
=
size
;
}
}
style
(
styles
:
IPanelStyles
):
void
{
...
...
src/vs/base/browser/ui/splitview/splitview2.ts
浏览文件 @
b28471d1
...
...
@@ -22,7 +22,7 @@ export interface ISplitViewOptions {
export
interface
IView
{
readonly
minimumSize
:
number
;
readonly
maximumSize
:
number
;
readonly
onDidChange
:
Event
<
voi
d
>
;
readonly
onDidChange
:
Event
<
number
|
undefine
d
>
;
render
(
container
:
HTMLElement
,
orientation
:
Orientation
):
void
;
layout
(
size
:
number
,
orientation
:
Orientation
):
void
;
}
...
...
@@ -87,7 +87,7 @@ export class SplitView implements IDisposable {
this
.
el
.
insertBefore
(
container
,
this
.
el
.
children
.
item
(
index
));
}
const
onChangeDisposable
=
mapEvent
(
view
.
onDidChange
,
()
=>
item
)(
this
.
onViewChange
,
this
);
const
onChangeDisposable
=
view
.
onDidChange
(
size
=>
this
.
onViewChange
(
item
,
size
)
);
const
containerDisposable
=
toDisposable
(()
=>
this
.
el
.
removeChild
(
container
));
const
disposable
=
combinedDisposable
([
onChangeDisposable
,
containerDisposable
]);
...
...
@@ -207,14 +207,15 @@ export class SplitView implements IDisposable {
this
.
resize
(
index
,
delta
,
sizes
);
}
private
onViewChange
(
item
:
IViewItem
):
void
{
private
onViewChange
(
item
:
IViewItem
,
size
:
number
|
undefined
):
void
{
const
index
=
this
.
viewItems
.
indexOf
(
item
);
if
(
index
<
0
||
index
>=
this
.
viewItems
.
length
)
{
return
;
}
const
size
=
clamp
(
item
.
size
,
item
.
view
.
minimumSize
,
item
.
view
.
maximumSize
);
size
=
typeof
size
===
'
number
'
?
size
:
item
.
size
;
size
=
clamp
(
size
,
item
.
view
.
minimumSize
,
item
.
view
.
maximumSize
);
item
.
size
=
size
;
this
.
relayout
();
}
...
...
src/vs/base/test/browser/ui/splitview/splitview.test.ts
浏览文件 @
b28471d1
...
...
@@ -10,7 +10,7 @@ import { Sash } from 'vs/base/browser/ui/sash/sash';
class
TestView
implements
IView
{
private
_onDidChange
=
new
Emitter
<
voi
d
>
();
private
_onDidChange
=
new
Emitter
<
number
|
undefine
d
>
();
readonly
onDidChange
=
this
.
_onDidChange
.
event
;
get
minimumSize
():
number
{
return
this
.
_minimumSize
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录