Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7e995286
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
未验证
提交
7e995286
编写于
12月 19, 2018
作者:
A
Alexandru Dima
提交者:
GitHub
12月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #65072 from TiagoR98/issue24344fix
Feature #24344 implemented
上级
16d736d9
699101e3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
46 addition
and
4 deletion
+46
-4
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
+8
-0
src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
+7
-0
src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts
...itor/browser/viewParts/editorScrollbar/editorScrollbar.ts
+3
-1
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+5
-0
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+17
-3
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+6
-0
未找到文件。
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
浏览文件 @
7e995286
...
...
@@ -281,6 +281,7 @@ export abstract class AbstractScrollableElement extends Widget {
let
massagedOptions
=
resolveOptions
(
newOptions
);
this
.
_options
.
handleMouseWheel
=
massagedOptions
.
handleMouseWheel
;
this
.
_options
.
mouseWheelScrollSensitivity
=
massagedOptions
.
mouseWheelScrollSensitivity
;
this
.
_options
.
fastScrollSensitivity
=
massagedOptions
.
fastScrollSensitivity
;
this
.
_setListeningToMouseWheel
(
this
.
_options
.
handleMouseWheel
);
if
(
!
this
.
_options
.
lazyRender
)
{
...
...
@@ -340,6 +341,12 @@ export abstract class AbstractScrollableElement extends Widget {
deltaY
=
0
;
}
if
(
e
.
browserEvent
&&
e
.
browserEvent
.
altKey
)
{
// fastScrolling
deltaX
=
deltaX
*
this
.
_options
.
fastScrollSensitivity
;
deltaY
=
deltaY
*
this
.
_options
.
fastScrollSensitivity
;
}
const
futureScrollPosition
=
this
.
_scrollable
.
getFutureScrollPosition
();
let
desiredScrollPosition
:
INewScrollPosition
=
{};
...
...
@@ -540,6 +547,7 @@ function resolveOptions(opts: ScrollableElementCreationOptions): ScrollableEleme
alwaysConsumeMouseWheel
:
(
typeof
opts
.
alwaysConsumeMouseWheel
!==
'
undefined
'
?
opts
.
alwaysConsumeMouseWheel
:
false
),
scrollYToX
:
(
typeof
opts
.
scrollYToX
!==
'
undefined
'
?
opts
.
scrollYToX
:
false
),
mouseWheelScrollSensitivity
:
(
typeof
opts
.
mouseWheelScrollSensitivity
!==
'
undefined
'
?
opts
.
mouseWheelScrollSensitivity
:
1
),
fastScrollSensitivity
:
(
typeof
opts
.
fastScrollSensitivity
!==
'
undefined
'
?
opts
.
fastScrollSensitivity
:
5
),
mouseWheelSmoothScroll
:
(
typeof
opts
.
mouseWheelSmoothScroll
!==
'
undefined
'
?
opts
.
mouseWheelSmoothScroll
:
true
),
arrowSize
:
(
typeof
opts
.
arrowSize
!==
'
undefined
'
?
opts
.
arrowSize
:
11
),
...
...
src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
浏览文件 @
7e995286
...
...
@@ -50,6 +50,11 @@ export interface ScrollableElementCreationOptions {
* Defaults to 1.
*/
mouseWheelScrollSensitivity
?:
number
;
/**
* FastScrolling mulitplier speed when pressing `Alt`
* Defaults to 5.
*/
fastScrollSensitivity
?:
number
;
/**
* Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right).
* Defaults to 11.
...
...
@@ -107,6 +112,7 @@ export interface ScrollableElementCreationOptions {
export
interface
ScrollableElementChangeOptions
{
handleMouseWheel
?:
boolean
;
mouseWheelScrollSensitivity
?:
number
;
fastScrollSensitivity
:
number
;
}
export
interface
ScrollableElementResolvedOptions
{
...
...
@@ -118,6 +124,7 @@ export interface ScrollableElementResolvedOptions {
scrollYToX
:
boolean
;
alwaysConsumeMouseWheel
:
boolean
;
mouseWheelScrollSensitivity
:
number
;
fastScrollSensitivity
:
number
;
mouseWheelSmoothScroll
:
boolean
;
arrowSize
:
number
;
listenOnDomNode
:
HTMLElement
|
null
;
...
...
src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts
浏览文件 @
7e995286
...
...
@@ -48,6 +48,7 @@ export class EditorScrollbar extends ViewPart {
handleMouseWheel
:
configScrollbarOpts
.
handleMouseWheel
,
arrowSize
:
configScrollbarOpts
.
arrowSize
,
mouseWheelScrollSensitivity
:
configScrollbarOpts
.
mouseWheelScrollSensitivity
,
fastScrollSensitivity
:
configScrollbarOpts
.
fastScrollSensitivity
,
};
this
.
scrollbar
=
this
.
_register
(
new
SmoothScrollableElement
(
linesContent
.
domNode
,
scrollbarOptions
,
this
.
_context
.
viewLayout
.
scrollable
));
...
...
@@ -127,7 +128,8 @@ export class EditorScrollbar extends ViewPart {
const
editor
=
this
.
_context
.
configuration
.
editor
;
let
newOpts
:
ScrollableElementChangeOptions
=
{
handleMouseWheel
:
editor
.
viewInfo
.
scrollbar
.
handleMouseWheel
,
mouseWheelScrollSensitivity
:
editor
.
viewInfo
.
scrollbar
.
mouseWheelScrollSensitivity
mouseWheelScrollSensitivity
:
editor
.
viewInfo
.
scrollbar
.
mouseWheelScrollSensitivity
,
fastScrollSensitivity
:
editor
.
viewInfo
.
scrollbar
.
fastScrollSensitivity
};
this
.
scrollbar
.
updateOptions
(
newOpts
);
}
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
7e995286
...
...
@@ -429,6 +429,11 @@ const editorConfiguration: IConfigurationNode = {
'
default
'
:
EDITOR_DEFAULTS
.
viewInfo
.
scrollbar
.
mouseWheelScrollSensitivity
,
'
markdownDescription
'
:
nls
.
localize
(
'
mouseWheelScrollSensitivity
'
,
"
A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
"
)
},
'
editor.fastScrollSensitivity
'
:
{
'
type
'
:
'
number
'
,
'
default
'
:
EDITOR_DEFAULTS
.
viewInfo
.
scrollbar
.
fastScrollSensitivity
,
'
markdownDescription
'
:
nls
.
localize
(
'
fastScrollSensitivity
'
,
"
Scrolling speed mulitiplier when pressing `Alt`
"
)
},
'
editor.multiCursorModifier
'
:
{
'
type
'
:
'
string
'
,
'
enum
'
:
[
'
ctrlCmd
'
,
'
alt
'
],
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
7e995286
...
...
@@ -458,6 +458,11 @@ export interface IEditorOptions {
* Defaults to 1.
*/
mouseWheelScrollSensitivity
?:
number
;
/**
* FastScrolling mulitplier speed when pressing `Alt`
* Defaults to 5.
*/
fastScrollSensitivity
?:
number
;
/**
* The modifier to be used to add multiple cursors with the mouse.
* Defaults to 'alt'
...
...
@@ -875,6 +880,7 @@ export interface InternalEditorScrollbarOptions {
readonly
verticalScrollbarSize
:
number
;
readonly
verticalSliderSize
:
number
;
readonly
mouseWheelScrollSensitivity
:
number
;
readonly
fastScrollSensitivity
:
number
;
}
export
interface
InternalEditorMinimapOptions
{
...
...
@@ -1292,6 +1298,7 @@ export class InternalEditorOptions {
&&
a
.
verticalScrollbarSize
===
b
.
verticalScrollbarSize
&&
a
.
verticalSliderSize
===
b
.
verticalSliderSize
&&
a
.
mouseWheelScrollSensitivity
===
b
.
mouseWheelScrollSensitivity
&&
a
.
fastScrollSensitivity
===
b
.
fastScrollSensitivity
);
}
...
...
@@ -1795,7 +1802,7 @@ export class EditorOptionsValidator {
};
}
private
static
_sanitizeScrollbarOpts
(
opts
:
IEditorScrollbarOptions
|
undefined
,
defaults
:
InternalEditorScrollbarOptions
,
mouseWheelScrollSensitivity
:
number
):
InternalEditorScrollbarOptions
{
private
static
_sanitizeScrollbarOpts
(
opts
:
IEditorScrollbarOptions
|
undefined
,
defaults
:
InternalEditorScrollbarOptions
,
mouseWheelScrollSensitivity
:
number
,
fastScrollSensitivity
:
number
):
InternalEditorScrollbarOptions
{
if
(
typeof
opts
!==
'
object
'
)
{
return
defaults
;
}
...
...
@@ -1818,7 +1825,8 @@ export class EditorOptionsValidator {
verticalSliderSize
:
_clampedInt
(
opts
.
verticalSliderSize
,
verticalScrollbarSize
,
0
,
1000
),
handleMouseWheel
:
_boolean
(
opts
.
handleMouseWheel
,
defaults
.
handleMouseWheel
),
mouseWheelScrollSensitivity
:
mouseWheelScrollSensitivity
mouseWheelScrollSensitivity
:
mouseWheelScrollSensitivity
,
fastScrollSensitivity
:
fastScrollSensitivity
,
};
}
...
...
@@ -1965,7 +1973,12 @@ export class EditorOptionsValidator {
// Disallow 0, as it would prevent/block scrolling
mouseWheelScrollSensitivity
=
1
;
}
const
scrollbar
=
this
.
_sanitizeScrollbarOpts
(
opts
.
scrollbar
,
defaults
.
scrollbar
,
mouseWheelScrollSensitivity
);
let
fastScrollSensitivity
=
_float
(
opts
.
fastScrollSensitivity
,
defaults
.
scrollbar
.
fastScrollSensitivity
);
if
(
fastScrollSensitivity
<=
0
)
{
fastScrollSensitivity
=
defaults
.
scrollbar
.
fastScrollSensitivity
;
}
const
scrollbar
=
this
.
_sanitizeScrollbarOpts
(
opts
.
scrollbar
,
defaults
.
scrollbar
,
mouseWheelScrollSensitivity
,
fastScrollSensitivity
);
const
minimap
=
this
.
_sanitizeMinimapOpts
(
opts
.
minimap
,
defaults
.
minimap
);
return
{
...
...
@@ -2592,6 +2605,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
verticalSliderSize
:
14
,
handleMouseWheel
:
true
,
mouseWheelScrollSensitivity
:
1
,
fastScrollSensitivity
:
5
,
},
minimap
:
{
enabled
:
true
,
...
...
src/vs/monaco.d.ts
浏览文件 @
7e995286
...
...
@@ -2787,6 +2787,11 @@ declare namespace monaco.editor {
* Defaults to 1.
*/
mouseWheelScrollSensitivity
?:
number
;
/**
* FastScrolling mulitplier speed when pressing `Alt`
* Defaults to 5.
*/
fastScrollSensitivity
?:
number
;
/**
* The modifier to be used to add multiple cursors with the mouse.
* Defaults to 'alt'
...
...
@@ -3149,6 +3154,7 @@ declare namespace monaco.editor {
readonly
verticalScrollbarSize
:
number
;
readonly
verticalSliderSize
:
number
;
readonly
mouseWheelScrollSensitivity
:
number
;
readonly
fastScrollSensitivity
:
number
;
}
export
interface
InternalEditorMinimapOptions
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录