Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
cfdc5898
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,发现更多精彩内容 >>
提交
cfdc5898
编写于
7月 15, 2019
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
splitview: fix snap enablement
上级
c836dfa0
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
45 addition
and
54 deletion
+45
-54
src/vs/base/browser/ui/splitview/splitview.ts
src/vs/base/browser/ui/splitview/splitview.ts
+44
-53
test/splitview/public/index.html
test/splitview/public/index.html
+1
-1
未找到文件。
src/vs/base/browser/ui/splitview/splitview.ts
浏览文件 @
cfdc5898
...
...
@@ -505,30 +505,8 @@ export class SplitView extends Disposable {
const
minDeltaDown
=
downIndexes
.
length
===
0
?
Number
.
NEGATIVE_INFINITY
:
downIndexes
.
reduce
((
r
,
i
)
=>
r
+
(
sizes
[
i
]
-
this
.
viewItems
[
i
].
viewMaximumSize
),
0
);
const
minDelta
=
Math
.
max
(
minDeltaUp
,
minDeltaDown
);
const
maxDelta
=
Math
.
min
(
maxDeltaDown
,
maxDeltaUp
);
const
findSnapIndex
=
(
indexes
:
number
[]):
number
|
undefined
=>
{
// visible views first
for
(
const
index
of
indexes
)
{
if
(
!
this
.
viewItems
[
index
].
visible
)
{
continue
;
}
if
(
this
.
viewItems
[
index
].
snap
)
{
return
index
;
}
}
// then, hidden views
for
(
const
index
of
indexes
)
{
if
(
!
this
.
viewItems
[
index
].
visible
&&
this
.
viewItems
[
index
].
snap
)
{
return
index
;
}
}
return
undefined
;
};
const
snapBeforeIndex
=
findSnapIndex
(
upIndexes
);
const
snapBeforeIndex
=
this
.
findFirstSnapIndex
(
upIndexes
);
const
snapAfterIndex
=
this
.
findFirstSnapIndex
(
downIndexes
);
if
(
typeof
snapBeforeIndex
===
'
number
'
)
{
const
viewItem
=
this
.
viewItems
[
snapBeforeIndex
];
...
...
@@ -540,8 +518,6 @@ export class SplitView extends Disposable {
};
}
const
snapAfterIndex
=
findSnapIndex
(
downIndexes
);
if
(
typeof
snapAfterIndex
===
'
number
'
)
{
const
viewItem
=
this
.
viewItems
[
snapAfterIndex
];
const
halfSize
=
Math
.
floor
(
viewItem
.
viewMinimumSize
/
2
);
...
...
@@ -799,38 +775,31 @@ export class SplitView extends Disposable {
previous
=
false
;
const
expandsUp
=
reverseViews
.
map
(
i
=>
previous
=
(
i
.
maximumSize
-
i
.
size
>
0
)
||
previous
).
reverse
();
const
firstVisibleViewIndex
=
firstIndex
(
this
.
viewItems
,
viewItem
=>
viewItem
.
visible
);
this
.
sashItems
.
forEach
((
s
,
i
)
=>
{
if
(
!
this
.
viewItems
[
i
].
visible
)
{
if
(
i
===
firstVisibleViewIndex
-
1
)
{
s
.
sash
.
state
=
SashState
.
Minimum
;
}
else
{
s
.
sash
.
state
=
SashState
.
Disabled
;
}
}
else
{
const
min
=
!
(
collapsesDown
[
i
]
&&
expandsUp
[
i
+
1
]);
const
max
=
!
(
expandsDown
[
i
]
&&
collapsesUp
[
i
+
1
]);
this
.
sashItems
.
forEach
(({
sash
},
index
)
=>
{
const
min
=
!
(
collapsesDown
[
index
]
&&
expandsUp
[
index
+
1
]);
const
max
=
!
(
expandsDown
[
index
]
&&
collapsesUp
[
index
+
1
]);
if
(
min
&&
max
)
{
const
before
=
!
range
(
0
,
i
+
1
).
some
(
i
=>
!
this
.
viewItems
[
i
].
snap
||
this
.
viewItems
[
i
].
visible
);
const
after
=
!
range
(
i
+
1
,
this
.
viewItems
.
length
).
some
(
i
=>
!
this
.
viewItems
[
i
].
snap
||
this
.
viewItems
[
i
].
visible
);
const
upIndexes
=
range
(
index
,
-
1
);
const
downIndexes
=
range
(
index
+
1
,
this
.
viewItems
.
length
);
const
snapBeforeIndex
=
this
.
findFirstSnapIndex
(
upIndexes
);
const
snapAfterIndex
=
this
.
findFirstSnapIndex
(
downIndexes
);
if
(
befor
e
)
{
s
.
sash
.
state
=
SashState
.
Minimum
;
}
else
if
(
after
)
{
s
.
sash
.
state
=
SashState
.
Maximum
;
if
(
typeof
snapBeforeIndex
===
'
number
'
&&
!
this
.
viewItems
[
snapBeforeIndex
].
visibl
e
)
{
sash
.
state
=
SashState
.
Minimum
;
}
else
if
(
typeof
snapAfterIndex
===
'
number
'
&&
!
this
.
viewItems
[
snapAfterIndex
].
visible
)
{
sash
.
state
=
SashState
.
Maximum
;
}
else
{
s
.
sash
.
state
=
SashState
.
Disabled
;
sash
.
state
=
SashState
.
Disabled
;
}
}
else
if
(
min
&&
!
max
)
{
s
.
sash
.
state
=
SashState
.
Minimum
;
sash
.
state
=
SashState
.
Minimum
;
}
else
if
(
!
min
&&
max
)
{
s
.
sash
.
state
=
SashState
.
Maximum
;
sash
.
state
=
SashState
.
Maximum
;
}
else
{
s
.
sash
.
state
=
SashState
.
Enabled
;
}
sash
.
state
=
SashState
.
Enabled
;
}
// }
});
}
...
...
@@ -848,6 +817,28 @@ export class SplitView extends Disposable {
return
0
;
}
private
findFirstSnapIndex
(
indexes
:
number
[]):
number
|
undefined
{
// visible views first
for
(
const
index
of
indexes
)
{
if
(
!
this
.
viewItems
[
index
].
visible
)
{
continue
;
}
if
(
this
.
viewItems
[
index
].
snap
)
{
return
index
;
}
}
// then, hidden views
for
(
const
index
of
indexes
)
{
if
(
!
this
.
viewItems
[
index
].
visible
&&
this
.
viewItems
[
index
].
snap
)
{
return
index
;
}
}
return
undefined
;
}
dispose
():
void
{
super
.
dispose
();
...
...
test/splitview/public/index.html
浏览文件 @
cfdc5898
...
...
@@ -103,7 +103,7 @@
this
.
minimumSize
=
typeof
minimumSize
===
'
number
'
?
minimumSize
:
100
;
this
.
maximumSize
=
typeof
maximumSize
===
'
number
'
?
maximumSize
:
Number
.
POSITIVE_INFINITY
;
this
.
onDidChange
=
Event
.
None
;
this
.
snap
=
tru
e
;
this
.
snap
=
!
minimumSize
&&
!
maximumSiz
e
;
this
.
button
=
document
.
createElement
(
'
button
'
);
this
.
button
.
onclick
=
()
=>
splitview
.
setViewVisible
(
this
.
id
,
!
splitview
.
isViewVisible
(
this
.
id
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录