Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1bf0aeae
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,发现更多精彩内容 >>
未验证
提交
1bf0aeae
编写于
2月 06, 2020
作者:
A
Alexandru Dima
提交者:
GitHub
2月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #70047 from gubikmic/scrollPredominantAxisOnly
Scroll predominant axis only (prevents scroll drift)
上级
9dd1ee40
ee613064
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
98 addition
and
57 deletion
+98
-57
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
+10
-0
src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
+9
-0
src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts
...itor/browser/viewParts/editorScrollbar/editorScrollbar.ts
+5
-1
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+10
-0
src/vs/editor/common/standalone/standaloneEnums.ts
src/vs/editor/common/standalone/standaloneEnums.ts
+29
-28
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+35
-28
未找到文件。
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
浏览文件 @
1bf0aeae
...
@@ -287,6 +287,7 @@ export abstract class AbstractScrollableElement extends Widget {
...
@@ -287,6 +287,7 @@ export abstract class AbstractScrollableElement extends Widget {
this
.
_options
.
handleMouseWheel
=
massagedOptions
.
handleMouseWheel
;
this
.
_options
.
handleMouseWheel
=
massagedOptions
.
handleMouseWheel
;
this
.
_options
.
mouseWheelScrollSensitivity
=
massagedOptions
.
mouseWheelScrollSensitivity
;
this
.
_options
.
mouseWheelScrollSensitivity
=
massagedOptions
.
mouseWheelScrollSensitivity
;
this
.
_options
.
fastScrollSensitivity
=
massagedOptions
.
fastScrollSensitivity
;
this
.
_options
.
fastScrollSensitivity
=
massagedOptions
.
fastScrollSensitivity
;
this
.
_options
.
scrollPredominantAxis
=
massagedOptions
.
scrollPredominantAxis
;
this
.
_setListeningToMouseWheel
(
this
.
_options
.
handleMouseWheel
);
this
.
_setListeningToMouseWheel
(
this
.
_options
.
handleMouseWheel
);
if
(
!
this
.
_options
.
lazyRender
)
{
if
(
!
this
.
_options
.
lazyRender
)
{
...
@@ -334,6 +335,14 @@ export abstract class AbstractScrollableElement extends Widget {
...
@@ -334,6 +335,14 @@ export abstract class AbstractScrollableElement extends Widget {
let
deltaY
=
e
.
deltaY
*
this
.
_options
.
mouseWheelScrollSensitivity
;
let
deltaY
=
e
.
deltaY
*
this
.
_options
.
mouseWheelScrollSensitivity
;
let
deltaX
=
e
.
deltaX
*
this
.
_options
.
mouseWheelScrollSensitivity
;
let
deltaX
=
e
.
deltaX
*
this
.
_options
.
mouseWheelScrollSensitivity
;
if
(
this
.
_options
.
scrollPredominantAxis
)
{
if
(
Math
.
abs
(
deltaY
)
>=
Math
.
abs
(
deltaX
))
{
deltaX
=
0
;
}
else
{
deltaY
=
0
;
}
}
if
(
this
.
_options
.
flipAxes
)
{
if
(
this
.
_options
.
flipAxes
)
{
[
deltaY
,
deltaX
]
=
[
deltaX
,
deltaY
];
[
deltaY
,
deltaX
]
=
[
deltaX
,
deltaY
];
}
}
...
@@ -553,6 +562,7 @@ function resolveOptions(opts: ScrollableElementCreationOptions): ScrollableEleme
...
@@ -553,6 +562,7 @@ function resolveOptions(opts: ScrollableElementCreationOptions): ScrollableEleme
scrollYToX
:
(
typeof
opts
.
scrollYToX
!==
'
undefined
'
?
opts
.
scrollYToX
:
false
),
scrollYToX
:
(
typeof
opts
.
scrollYToX
!==
'
undefined
'
?
opts
.
scrollYToX
:
false
),
mouseWheelScrollSensitivity
:
(
typeof
opts
.
mouseWheelScrollSensitivity
!==
'
undefined
'
?
opts
.
mouseWheelScrollSensitivity
:
1
),
mouseWheelScrollSensitivity
:
(
typeof
opts
.
mouseWheelScrollSensitivity
!==
'
undefined
'
?
opts
.
mouseWheelScrollSensitivity
:
1
),
fastScrollSensitivity
:
(
typeof
opts
.
fastScrollSensitivity
!==
'
undefined
'
?
opts
.
fastScrollSensitivity
:
5
),
fastScrollSensitivity
:
(
typeof
opts
.
fastScrollSensitivity
!==
'
undefined
'
?
opts
.
fastScrollSensitivity
:
5
),
scrollPredominantAxis
:
(
typeof
opts
.
scrollPredominantAxis
!==
'
undefined
'
?
opts
.
scrollPredominantAxis
:
true
),
mouseWheelSmoothScroll
:
(
typeof
opts
.
mouseWheelSmoothScroll
!==
'
undefined
'
?
opts
.
mouseWheelSmoothScroll
:
true
),
mouseWheelSmoothScroll
:
(
typeof
opts
.
mouseWheelSmoothScroll
!==
'
undefined
'
?
opts
.
mouseWheelSmoothScroll
:
true
),
arrowSize
:
(
typeof
opts
.
arrowSize
!==
'
undefined
'
?
opts
.
arrowSize
:
11
),
arrowSize
:
(
typeof
opts
.
arrowSize
!==
'
undefined
'
?
opts
.
arrowSize
:
11
),
...
...
src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
浏览文件 @
1bf0aeae
...
@@ -55,6 +55,13 @@ export interface ScrollableElementCreationOptions {
...
@@ -55,6 +55,13 @@ export interface ScrollableElementCreationOptions {
* Defaults to 5.
* Defaults to 5.
*/
*/
fastScrollSensitivity
?:
number
;
fastScrollSensitivity
?:
number
;
/**
* Whether the scrollable will only scroll along the predominant axis when scrolling both
* vertically and horizontally at the same time.
* Prevents horizontal drift when scrolling vertically on a trackpad.
* Defaults to true.
*/
scrollPredominantAxis
?:
boolean
;
/**
/**
* Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right).
* Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right).
* Defaults to 11.
* Defaults to 11.
...
@@ -113,6 +120,7 @@ export interface ScrollableElementChangeOptions {
...
@@ -113,6 +120,7 @@ export interface ScrollableElementChangeOptions {
handleMouseWheel
?:
boolean
;
handleMouseWheel
?:
boolean
;
mouseWheelScrollSensitivity
?:
number
;
mouseWheelScrollSensitivity
?:
number
;
fastScrollSensitivity
:
number
;
fastScrollSensitivity
:
number
;
scrollPredominantAxis
:
boolean
;
}
}
export
interface
ScrollableElementResolvedOptions
{
export
interface
ScrollableElementResolvedOptions
{
...
@@ -125,6 +133,7 @@ export interface ScrollableElementResolvedOptions {
...
@@ -125,6 +133,7 @@ export interface ScrollableElementResolvedOptions {
alwaysConsumeMouseWheel
:
boolean
;
alwaysConsumeMouseWheel
:
boolean
;
mouseWheelScrollSensitivity
:
number
;
mouseWheelScrollSensitivity
:
number
;
fastScrollSensitivity
:
number
;
fastScrollSensitivity
:
number
;
scrollPredominantAxis
:
boolean
;
mouseWheelSmoothScroll
:
boolean
;
mouseWheelSmoothScroll
:
boolean
;
arrowSize
:
number
;
arrowSize
:
number
;
listenOnDomNode
:
HTMLElement
|
null
;
listenOnDomNode
:
HTMLElement
|
null
;
...
...
src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts
浏览文件 @
1bf0aeae
...
@@ -34,6 +34,7 @@ export class EditorScrollbar extends ViewPart {
...
@@ -34,6 +34,7 @@ export class EditorScrollbar extends ViewPart {
const
scrollbar
=
options
.
get
(
EditorOption
.
scrollbar
);
const
scrollbar
=
options
.
get
(
EditorOption
.
scrollbar
);
const
mouseWheelScrollSensitivity
=
options
.
get
(
EditorOption
.
mouseWheelScrollSensitivity
);
const
mouseWheelScrollSensitivity
=
options
.
get
(
EditorOption
.
mouseWheelScrollSensitivity
);
const
fastScrollSensitivity
=
options
.
get
(
EditorOption
.
fastScrollSensitivity
);
const
fastScrollSensitivity
=
options
.
get
(
EditorOption
.
fastScrollSensitivity
);
const
scrollPredominantAxis
=
options
.
get
(
EditorOption
.
scrollPredominantAxis
);
const
scrollbarOptions
:
ScrollableElementCreationOptions
=
{
const
scrollbarOptions
:
ScrollableElementCreationOptions
=
{
listenOnDomNode
:
viewDomNode
.
domNode
,
listenOnDomNode
:
viewDomNode
.
domNode
,
...
@@ -54,6 +55,7 @@ export class EditorScrollbar extends ViewPart {
...
@@ -54,6 +55,7 @@ export class EditorScrollbar extends ViewPart {
arrowSize
:
scrollbar
.
arrowSize
,
arrowSize
:
scrollbar
.
arrowSize
,
mouseWheelScrollSensitivity
:
mouseWheelScrollSensitivity
,
mouseWheelScrollSensitivity
:
mouseWheelScrollSensitivity
,
fastScrollSensitivity
:
fastScrollSensitivity
,
fastScrollSensitivity
:
fastScrollSensitivity
,
scrollPredominantAxis
:
scrollPredominantAxis
,
};
};
this
.
scrollbar
=
this
.
_register
(
new
SmoothScrollableElement
(
linesContent
.
domNode
,
scrollbarOptions
,
this
.
_context
.
viewLayout
.
getScrollable
()));
this
.
scrollbar
=
this
.
_register
(
new
SmoothScrollableElement
(
linesContent
.
domNode
,
scrollbarOptions
,
this
.
_context
.
viewLayout
.
getScrollable
()));
...
@@ -140,10 +142,12 @@ export class EditorScrollbar extends ViewPart {
...
@@ -140,10 +142,12 @@ export class EditorScrollbar extends ViewPart {
const
scrollbar
=
options
.
get
(
EditorOption
.
scrollbar
);
const
scrollbar
=
options
.
get
(
EditorOption
.
scrollbar
);
const
mouseWheelScrollSensitivity
=
options
.
get
(
EditorOption
.
mouseWheelScrollSensitivity
);
const
mouseWheelScrollSensitivity
=
options
.
get
(
EditorOption
.
mouseWheelScrollSensitivity
);
const
fastScrollSensitivity
=
options
.
get
(
EditorOption
.
fastScrollSensitivity
);
const
fastScrollSensitivity
=
options
.
get
(
EditorOption
.
fastScrollSensitivity
);
const
scrollPredominantAxis
=
options
.
get
(
EditorOption
.
scrollPredominantAxis
);
const
newOpts
:
ScrollableElementChangeOptions
=
{
const
newOpts
:
ScrollableElementChangeOptions
=
{
handleMouseWheel
:
scrollbar
.
handleMouseWheel
,
handleMouseWheel
:
scrollbar
.
handleMouseWheel
,
mouseWheelScrollSensitivity
:
mouseWheelScrollSensitivity
,
mouseWheelScrollSensitivity
:
mouseWheelScrollSensitivity
,
fastScrollSensitivity
:
fastScrollSensitivity
fastScrollSensitivity
:
fastScrollSensitivity
,
scrollPredominantAxis
:
scrollPredominantAxis
};
};
this
.
scrollbar
.
updateOptions
(
newOpts
);
this
.
scrollbar
.
updateOptions
(
newOpts
);
}
}
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
1bf0aeae
...
@@ -319,6 +319,11 @@ export interface IEditorOptions {
...
@@ -319,6 +319,11 @@ export interface IEditorOptions {
* Defaults to 5.
* Defaults to 5.
*/
*/
fastScrollSensitivity
?:
number
;
fastScrollSensitivity
?:
number
;
/**
* Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.
* Defaults to true.
*/
scrollPredominantAxis
?:
boolean
;
/**
/**
* The modifier to be used to add multiple cursors with the mouse.
* The modifier to be used to add multiple cursors with the mouse.
* Defaults to 'alt'
* Defaults to 'alt'
...
@@ -3193,6 +3198,7 @@ export const enum EditorOption {
...
@@ -3193,6 +3198,7 @@ export const enum EditorOption {
scrollbar
,
scrollbar
,
scrollBeyondLastColumn
,
scrollBeyondLastColumn
,
scrollBeyondLastLine
,
scrollBeyondLastLine
,
scrollPredominantAxis
,
selectionClipboard
,
selectionClipboard
,
selectionHighlight
,
selectionHighlight
,
selectOnLineNumbers
,
selectOnLineNumbers
,
...
@@ -3651,6 +3657,10 @@ export const EditorOptions = {
...
@@ -3651,6 +3657,10 @@ export const EditorOptions = {
EditorOption
.
scrollBeyondLastLine
,
'
scrollBeyondLastLine
'
,
true
,
EditorOption
.
scrollBeyondLastLine
,
'
scrollBeyondLastLine
'
,
true
,
{
description
:
nls
.
localize
(
'
scrollBeyondLastLine
'
,
"
Controls whether the editor will scroll beyond the last line.
"
)
}
{
description
:
nls
.
localize
(
'
scrollBeyondLastLine
'
,
"
Controls whether the editor will scroll beyond the last line.
"
)
}
)),
)),
scrollPredominantAxis
:
register
(
new
EditorBooleanOption
(
EditorOption
.
scrollPredominantAxis
,
'
scrollPredominantAxis
'
,
true
,
{
description
:
nls
.
localize
(
'
scrollPredominantAxis
'
,
"
Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.
"
)
}
)),
selectionClipboard
:
register
(
new
EditorBooleanOption
(
selectionClipboard
:
register
(
new
EditorBooleanOption
(
EditorOption
.
selectionClipboard
,
'
selectionClipboard
'
,
true
,
EditorOption
.
selectionClipboard
,
'
selectionClipboard
'
,
true
,
{
{
...
...
src/vs/editor/common/standalone/standaloneEnums.ts
浏览文件 @
1bf0aeae
...
@@ -247,34 +247,35 @@ export enum EditorOption {
...
@@ -247,34 +247,35 @@ export enum EditorOption {
scrollbar
=
79
,
scrollbar
=
79
,
scrollBeyondLastColumn
=
80
,
scrollBeyondLastColumn
=
80
,
scrollBeyondLastLine
=
81
,
scrollBeyondLastLine
=
81
,
selectionClipboard
=
82
,
scrollPredominantAxis
=
82
,
selectionHighlight
=
83
,
selectionClipboard
=
83
,
selectOnLineNumbers
=
84
,
selectionHighlight
=
84
,
showFoldingControls
=
85
,
selectOnLineNumbers
=
85
,
showUnused
=
86
,
showFoldingControls
=
86
,
snippetSuggestions
=
87
,
showUnused
=
87
,
smoothScrolling
=
88
,
snippetSuggestions
=
88
,
stopRenderingLineAfter
=
89
,
smoothScrolling
=
89
,
suggest
=
90
,
stopRenderingLineAfter
=
90
,
suggestFontSize
=
91
,
suggest
=
91
,
suggestLineHeight
=
92
,
suggestFontSize
=
92
,
suggestOnTriggerCharacters
=
93
,
suggestLineHeight
=
93
,
suggestSelection
=
94
,
suggestOnTriggerCharacters
=
94
,
tabCompletion
=
95
,
suggestSelection
=
95
,
useTabStops
=
96
,
tabCompletion
=
96
,
wordSeparators
=
97
,
useTabStops
=
97
,
wordWrap
=
98
,
wordSeparators
=
98
,
wordWrapBreakAfterCharacters
=
99
,
wordWrap
=
99
,
wordWrapBreakBeforeCharacters
=
100
,
wordWrapBreakAfterCharacters
=
100
,
wordWrapColumn
=
101
,
wordWrapBreakBeforeCharacters
=
101
,
wordWrapMinified
=
102
,
wordWrapColumn
=
102
,
wrappingIndent
=
103
,
wordWrapMinified
=
103
,
wrappingStrategy
=
104
,
wrappingIndent
=
104
,
editorClassName
=
105
,
wrappingStrategy
=
105
,
pixelRatio
=
106
,
editorClassName
=
106
,
tabFocusMode
=
107
,
pixelRatio
=
107
,
layoutInfo
=
108
,
tabFocusMode
=
108
,
wrappingInfo
=
109
layoutInfo
=
109
,
wrappingInfo
=
110
}
}
/**
/**
...
...
src/vs/monaco.d.ts
浏览文件 @
1bf0aeae
...
@@ -2794,6 +2794,11 @@ declare namespace monaco.editor {
...
@@ -2794,6 +2794,11 @@ declare namespace monaco.editor {
* Defaults to 5.
* Defaults to 5.
*/
*/
fastScrollSensitivity
?:
number
;
fastScrollSensitivity
?:
number
;
/**
* Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.
* Defaults to true.
*/
scrollPredominantAxis
?:
boolean
;
/**
/**
* The modifier to be used to add multiple cursors with the mouse.
* The modifier to be used to add multiple cursors with the mouse.
* Defaults to 'alt'
* Defaults to 'alt'
...
@@ -3772,34 +3777,35 @@ declare namespace monaco.editor {
...
@@ -3772,34 +3777,35 @@ declare namespace monaco.editor {
scrollbar
=
79
,
scrollbar
=
79
,
scrollBeyondLastColumn
=
80
,
scrollBeyondLastColumn
=
80
,
scrollBeyondLastLine
=
81
,
scrollBeyondLastLine
=
81
,
selectionClipboard
=
82
,
scrollPredominantAxis
=
82
,
selectionHighlight
=
83
,
selectionClipboard
=
83
,
selectOnLineNumbers
=
84
,
selectionHighlight
=
84
,
showFoldingControls
=
85
,
selectOnLineNumbers
=
85
,
showUnused
=
86
,
showFoldingControls
=
86
,
snippetSuggestions
=
87
,
showUnused
=
87
,
smoothScrolling
=
88
,
snippetSuggestions
=
88
,
stopRenderingLineAfter
=
89
,
smoothScrolling
=
89
,
suggest
=
90
,
stopRenderingLineAfter
=
90
,
suggestFontSize
=
91
,
suggest
=
91
,
suggestLineHeight
=
92
,
suggestFontSize
=
92
,
suggestOnTriggerCharacters
=
93
,
suggestLineHeight
=
93
,
suggestSelection
=
94
,
suggestOnTriggerCharacters
=
94
,
tabCompletion
=
95
,
suggestSelection
=
95
,
useTabStops
=
96
,
tabCompletion
=
96
,
wordSeparators
=
97
,
useTabStops
=
97
,
wordWrap
=
98
,
wordSeparators
=
98
,
wordWrapBreakAfterCharacters
=
99
,
wordWrap
=
99
,
wordWrapBreakBeforeCharacters
=
100
,
wordWrapBreakAfterCharacters
=
100
,
wordWrapColumn
=
101
,
wordWrapBreakBeforeCharacters
=
101
,
wordWrapMinified
=
102
,
wordWrapColumn
=
102
,
wrappingIndent
=
103
,
wordWrapMinified
=
103
,
wrappingStrategy
=
104
,
wrappingIndent
=
104
,
editorClassName
=
105
,
wrappingStrategy
=
105
,
pixelRatio
=
106
,
editorClassName
=
106
,
tabFocusMode
=
107
,
pixelRatio
=
107
,
layoutInfo
=
108
,
tabFocusMode
=
108
,
wrappingInfo
=
109
layoutInfo
=
109
,
wrappingInfo
=
110
}
}
export
const
EditorOptions
:
{
export
const
EditorOptions
:
{
acceptSuggestionOnCommitCharacter
:
IEditorOption
<
EditorOption
.
acceptSuggestionOnCommitCharacter
,
boolean
>
;
acceptSuggestionOnCommitCharacter
:
IEditorOption
<
EditorOption
.
acceptSuggestionOnCommitCharacter
,
boolean
>
;
...
@@ -3884,6 +3890,7 @@ declare namespace monaco.editor {
...
@@ -3884,6 +3890,7 @@ declare namespace monaco.editor {
scrollbar
:
IEditorOption
<
EditorOption
.
scrollbar
,
InternalEditorScrollbarOptions
>
;
scrollbar
:
IEditorOption
<
EditorOption
.
scrollbar
,
InternalEditorScrollbarOptions
>
;
scrollBeyondLastColumn
:
IEditorOption
<
EditorOption
.
scrollBeyondLastColumn
,
number
>
;
scrollBeyondLastColumn
:
IEditorOption
<
EditorOption
.
scrollBeyondLastColumn
,
number
>
;
scrollBeyondLastLine
:
IEditorOption
<
EditorOption
.
scrollBeyondLastLine
,
boolean
>
;
scrollBeyondLastLine
:
IEditorOption
<
EditorOption
.
scrollBeyondLastLine
,
boolean
>
;
scrollPredominantAxis
:
IEditorOption
<
EditorOption
.
scrollPredominantAxis
,
boolean
>
;
selectionClipboard
:
IEditorOption
<
EditorOption
.
selectionClipboard
,
boolean
>
;
selectionClipboard
:
IEditorOption
<
EditorOption
.
selectionClipboard
,
boolean
>
;
selectionHighlight
:
IEditorOption
<
EditorOption
.
selectionHighlight
,
boolean
>
;
selectionHighlight
:
IEditorOption
<
EditorOption
.
selectionHighlight
,
boolean
>
;
selectOnLineNumbers
:
IEditorOption
<
EditorOption
.
selectOnLineNumbers
,
boolean
>
;
selectOnLineNumbers
:
IEditorOption
<
EditorOption
.
selectOnLineNumbers
,
boolean
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录