Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d357d028
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,发现更多精彩内容 >>
提交
d357d028
编写于
5月 08, 2020
作者:
L
Ladislau Szomoru
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add setting to control the sash size
上级
5d77caf9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
129 addition
and
86 deletion
+129
-86
build/lib/i18n.resources.json
build/lib/i18n.resources.json
+4
-0
src/vs/base/browser/ui/sash/sash.css
src/vs/base/browser/ui/sash/sash.css
+1
-56
src/vs/base/browser/ui/sash/sash.ts
src/vs/base/browser/ui/sash/sash.ts
+38
-30
src/vs/workbench/contrib/sash/browser/sash.contribution.ts
src/vs/workbench/contrib/sash/browser/sash.contribution.ts
+32
-0
src/vs/workbench/contrib/sash/browser/sash.ts
src/vs/workbench/contrib/sash/browser/sash.ts
+51
-0
src/vs/workbench/workbench.common.main.ts
src/vs/workbench/workbench.common.main.ts
+3
-0
未找到文件。
build/lib/i18n.resources.json
浏览文件 @
d357d028
...
...
@@ -138,6 +138,10 @@
"name"
:
"vs/workbench/contrib/relauncher"
,
"project"
:
"vscode-workbench"
},
{
"name"
:
"vs/workbench/contrib/sash"
,
"project"
:
"vscode-workbench"
},
{
"name"
:
"vs/workbench/contrib/scm"
,
"project"
:
"vscode-workbench"
...
...
src/vs/base/browser/ui/sash/sash.css
浏览文件 @
d357d028
...
...
@@ -13,13 +13,6 @@
pointer-events
:
none
;
}
.monaco-sash.vertical
{
cursor
:
ew-resize
;
top
:
0
;
width
:
4px
;
height
:
100%
;
}
.monaco-sash.mac.vertical
{
cursor
:
col-resize
;
}
...
...
@@ -32,13 +25,6 @@
cursor
:
w-resize
;
}
.monaco-sash.horizontal
{
cursor
:
ns-resize
;
left
:
0
;
width
:
100%
;
height
:
4px
;
}
.monaco-sash.mac.horizontal
{
cursor
:
row-resize
;
}
...
...
@@ -51,52 +37,11 @@
cursor
:
n-resize
;
}
.monaco-sash
:not
(
.disabled
)
.orthogonal-start
::before
,
.monaco-sash
:not
(
.disabled
)
.orthogonal-end
::after
{
content
:
' '
;
height
:
8px
;
width
:
8px
;
z-index
:
100
;
display
:
block
;
cursor
:
all-scroll
;
position
:
absolute
;
}
.monaco-sash.orthogonal-start.vertical
::before
{
left
:
-2px
;
top
:
-4px
;
}
.monaco-sash.orthogonal-end.vertical
::after
{
left
:
-2px
;
bottom
:
-4px
;
}
.monaco-sash.orthogonal-start.horizontal
::before
{
top
:
-2px
;
left
:
-4px
;
}
.monaco-sash.orthogonal-end.horizontal
::after
{
top
:
-2px
;
right
:
-4px
;
}
.monaco-sash.disabled
{
cursor
:
default
!important
;
pointer-events
:
none
!important
;
}
/** Touch **/
.monaco-sash.touch.vertical
{
width
:
20px
;
}
.monaco-sash.touch.horizontal
{
height
:
20px
;
}
/** Debug **/
.monaco-sash.debug
{
...
...
@@ -110,4 +55,4 @@
.monaco-sash.debug
:not
(
.disabled
)
.orthogonal-start
::before
,
.monaco-sash.debug
:not
(
.disabled
)
.orthogonal-end
::after
{
background
:
red
;
}
\ No newline at end of file
}
src/vs/base/browser/ui/sash/sash.ts
浏览文件 @
d357d028
...
...
@@ -15,6 +15,8 @@ import { getElementsByTagName, EventHelper, createStyleSheet, addDisposableListe
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
const
DEBUG
=
false
;
export
const
minSize
=
4
;
export
const
maxSize
=
20
;
// see also https://ux.stackexchange.com/questions/39023/what-is-the-optimum-button-size-of-touch-screen-applications
export
interface
ISashLayoutProvider
{
}
...
...
@@ -56,7 +58,14 @@ export const enum SashState {
Enabled
}
const
_onDidChangeSize
=
new
Emitter
<
number
>
();
const
onDidChangeSize
:
Event
<
number
>
=
_onDidChangeSize
.
event
;
export
function
setSashSize
(
size
:
number
):
void
{
_onDidChangeSize
.
fire
(
size
);
}
export
class
Sash
extends
Disposable
{
private
static
size
:
number
;
private
el
:
HTMLElement
;
private
layoutProvider
:
ISashLayoutProvider
;
...
...
@@ -130,6 +139,7 @@ export class Sash extends Disposable {
constructor
(
container
:
HTMLElement
,
layoutProvider
:
ISashLayoutProvider
,
options
:
ISashOptions
=
{})
{
super
();
Sash
.
size
=
isIPad
?
maxSize
:
minSize
;
this
.
el
=
append
(
container
,
$
(
'
.monaco-sash
'
));
if
(
isMacintosh
)
{
...
...
@@ -142,10 +152,10 @@ export class Sash extends Disposable {
this
.
_register
(
Gesture
.
addTarget
(
this
.
el
));
this
.
_register
(
domEvent
(
this
.
el
,
EventType
.
Start
)(
this
.
onTouchStart
,
this
));
if
(
isIPad
)
{
// see also https://ux.stackexchange.com/questions/39023/what-is-the-optimum-button-size-of-touch-screen-applications
addClass
(
this
.
el
,
'
touch
'
);
}
this
.
_register
(
onDidChangeSize
(
size
=>
{
Sash
.
size
=
size
;
this
.
layout
(
);
}
));
this
.
setOrientation
(
options
.
orientation
||
Orientation
.
VERTICAL
);
...
...
@@ -169,9 +179,7 @@ export class Sash extends Disposable {
addClass
(
this
.
el
,
'
vertical
'
);
}
if
(
this
.
layoutProvider
)
{
this
.
layout
();
}
this
.
layout
();
}
private
onMouseDown
(
e
:
MouseEvent
):
void
{
...
...
@@ -331,29 +339,29 @@ export class Sash extends Disposable {
}
layout
():
void
{
const
size
=
isIPad
?
20
:
4
;
if
(
this
.
orientation
===
Orientation
.
VERTICAL
)
{
const
verticalProvider
=
(
<
IVerticalSashLayoutProvider
>
this
.
layoutProvider
);
this
.
el
.
style
.
left
=
verticalProvider
.
getVerticalSashLeft
(
this
)
-
(
size
/
2
)
+
'
px
'
;
if
(
this
.
layoutProvider
)
{
if
(
this
.
orientation
===
Orientation
.
VERTICAL
)
{
const
verticalProvider
=
(
<
IVerticalSashLayoutProvider
>
this
.
layoutProvider
);
this
.
el
.
style
.
left
=
verticalProvider
.
getVerticalSashLeft
(
this
)
-
(
Sash
.
size
/
2
)
+
'
px
'
;
if
(
verticalProvider
.
getVerticalSashTop
)
{
this
.
el
.
style
.
top
=
verticalProvider
.
getVerticalSashTop
(
this
)
+
'
px
'
;
}
if
(
verticalProvider
.
getVerticalSashTop
)
{
this
.
el
.
style
.
top
=
verticalProvider
.
getVerticalSashTop
(
this
)
+
'
px
'
;
}
if
(
verticalProvider
.
getVerticalSashHeight
)
{
this
.
el
.
style
.
height
=
verticalProvider
.
getVerticalSashHeight
(
this
)
+
'
px
'
;
}
}
else
{
const
horizontalProvider
=
(
<
IHorizontalSashLayoutProvider
>
this
.
layoutProvider
);
this
.
el
.
style
.
top
=
horizontalProvider
.
getHorizontalSashTop
(
this
)
-
(
size
/
2
)
+
'
px
'
;
if
(
verticalProvider
.
getVerticalSashHeight
)
{
this
.
el
.
style
.
height
=
verticalProvider
.
getVerticalSashHeight
(
this
)
+
'
px
'
;
}
}
else
{
const
horizontalProvider
=
(
<
IHorizontalSashLayoutProvider
>
this
.
layoutProvider
);
this
.
el
.
style
.
top
=
horizontalProvider
.
getHorizontalSashTop
(
this
)
-
(
Sash
.
size
/
2
)
+
'
px
'
;
if
(
horizontalProvider
.
getHorizontalSashLeft
)
{
this
.
el
.
style
.
left
=
horizontalProvider
.
getHorizontalSashLeft
(
this
)
+
'
px
'
;
}
if
(
horizontalProvider
.
getHorizontalSashLeft
)
{
this
.
el
.
style
.
left
=
horizontalProvider
.
getHorizontalSashLeft
(
this
)
+
'
px
'
;
}
if
(
horizontalProvider
.
getHorizontalSashWidth
)
{
this
.
el
.
style
.
width
=
horizontalProvider
.
getHorizontalSashWidth
(
this
)
+
'
px
'
;
if
(
horizontalProvider
.
getHorizontalSashWidth
)
{
this
.
el
.
style
.
width
=
horizontalProvider
.
getHorizontalSashWidth
(
this
)
+
'
px
'
;
}
}
}
}
...
...
@@ -384,15 +392,15 @@ export class Sash extends Disposable {
private
getOrthogonalSash
(
e
:
MouseEvent
):
Sash
|
undefined
{
if
(
this
.
orientation
===
Orientation
.
VERTICAL
)
{
if
(
e
.
offsetY
<=
4
)
{
if
(
e
.
offsetY
<=
Sash
.
size
)
{
return
this
.
orthogonalStartSash
;
}
else
if
(
e
.
offsetY
>=
this
.
el
.
clientHeight
-
4
)
{
}
else
if
(
e
.
offsetY
>=
this
.
el
.
clientHeight
-
Sash
.
size
)
{
return
this
.
orthogonalEndSash
;
}
}
else
{
if
(
e
.
offsetX
<=
4
)
{
if
(
e
.
offsetX
<=
Sash
.
size
)
{
return
this
.
orthogonalStartSash
;
}
else
if
(
e
.
offsetX
>=
this
.
el
.
clientWidth
-
4
)
{
}
else
if
(
e
.
offsetX
>=
this
.
el
.
clientWidth
-
Sash
.
size
)
{
return
this
.
orthogonalEndSash
;
}
}
...
...
src/vs/workbench/contrib/sash/browser/sash.contribution.ts
0 → 100644
浏览文件 @
d357d028
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
minSize
,
maxSize
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
workbenchConfigurationNodeBase
}
from
'
vs/workbench/common/configuration
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
SashSizeController
}
from
'
vs/workbench/contrib/sash/browser/sash
'
;
// Sash size contribution
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
SashSizeController
,
LifecyclePhase
.
Starting
);
// Sash size configuration contribution
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
)
.
registerConfiguration
({
...
workbenchConfigurationNodeBase
,
'
properties
'
:
{
'
workbench.sash.size
'
:
{
'
type
'
:
'
number
'
,
'
default
'
:
minSize
,
'
minimum
'
:
minSize
,
'
maximum
'
:
maxSize
,
'
description
'
:
localize
(
'
sashSize
'
,
"
Controls the size of the sash.
"
)
},
}
});
src/vs/workbench/contrib/sash/browser/sash.ts
0 → 100644
浏览文件 @
d357d028
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
createStyleSheet
}
from
'
vs/base/browser/dom
'
;
import
{
setSashSize
,
minSize
,
maxSize
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
Disposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
isIPad
}
from
'
vs/base/browser/browser
'
;
export
class
SashSizeController
extends
Disposable
implements
IWorkbenchContribution
{
private
readonly
configurationName
=
'
workbench.sash.size
'
;
private
stylesheet
:
HTMLStyleElement
;
constructor
(
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
)
{
super
();
this
.
stylesheet
=
createStyleSheet
();
this
.
_register
(
toDisposable
(()
=>
this
.
stylesheet
.
parentElement
!
.
removeChild
(
this
.
stylesheet
)));
const
onDidChangeSizeConfiguration
=
Event
.
filter
(
configurationService
.
onDidChangeConfiguration
,
e
=>
e
.
affectsConfiguration
(
this
.
configurationName
));
this
.
_register
(
onDidChangeSizeConfiguration
(
this
.
onDidChangeSizeConfiguration
,
this
));
this
.
onDidChangeSizeConfiguration
();
}
private
onDidChangeSizeConfiguration
():
void
{
const
size
=
this
.
configurationService
.
getValue
<
number
>
(
this
.
configurationName
);
if
(
!
isIPad
&&
size
&&
size
>=
minSize
&&
size
<=
maxSize
)
{
// Update styles
const
styles
:
string
[]
=
[];
styles
.
push
(
`.monaco-sash.vertical { cursor: ew-resize; top: 0; width:
${
size
}
px; height: 100%; }`
);
styles
.
push
(
`.monaco-sash.horizontal { cursor: ns-resize; left: 0; width: 100%; height:
${
size
}
px; }`
);
styles
.
push
(
`.monaco-sash:not(.disabled).orthogonal-start::before, .monaco-sash:not(.disabled).orthogonal-end::after { content: ' '; height:
${
size
*
2
}
px; width:
${
size
*
2
}
px; z-index: 100; display: block; cursor: all-scroll; position: absolute; }`
);
styles
.
push
(
`.monaco-sash.orthogonal-start.vertical::before { left: -
${
size
/
2
}
px; top: -
${
size
}
px; }`
);
styles
.
push
(
`.monaco-sash.orthogonal-end.vertical::after { left: -
${
size
/
2
}
px; bottom: -
${
size
}
px; }`
);
styles
.
push
(
`.monaco-sash.orthogonal-start.horizontal::before { top: -
${
size
/
2
}
px; left: -
${
size
}
px; }`
);
styles
.
push
(
`.monaco-sash.orthogonal-end.horizontal::after { top: -
${
size
/
2
}
px; right: -
${
size
}
px; }`
);
this
.
stylesheet
.
innerHTML
=
styles
.
join
(
'
\n
'
);
// Update behavor
setSashSize
(
size
);
}
}
}
src/vs/workbench/workbench.common.main.ts
浏览文件 @
d357d028
...
...
@@ -166,6 +166,9 @@ import 'vs/workbench/contrib/search/browser/searchView';
// Search Editor
import
'
vs/workbench/contrib/searchEditor/browser/searchEditor.contribution
'
;
// Sash
import
'
vs/workbench/contrib/sash/browser/sash.contribution
'
;
// SCM
import
'
vs/workbench/contrib/scm/browser/scm.contribution
'
;
import
'
vs/workbench/contrib/scm/browser/scmViewlet
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录