Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
06a6d539
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,发现更多精彩内容 >>
提交
06a6d539
编写于
11月 14, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #62981
上级
3ad0008f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
63 deletion
+28
-63
src/vs/base/browser/mouseEvent.ts
src/vs/base/browser/mouseEvent.ts
+10
-42
src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts
src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts
+2
-2
src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts
src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts
+3
-3
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
+6
-8
src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts
src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts
+3
-3
src/vs/editor/browser/controller/mouseHandler.ts
src/vs/editor/browser/controller/mouseHandler.ts
+4
-5
未找到文件。
src/vs/base/browser/mouseEvent.ts
浏览文件 @
06a6d539
...
...
@@ -3,9 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
IframeUtils
}
from
'
vs/base/browser/iframe
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
export
interface
IMouseEvent
{
readonly
browserEvent
:
MouseEvent
;
...
...
@@ -113,26 +111,14 @@ export class DragMouseEvent extends StandardMouseEvent {
}
interface
IWebKitMouseWheelEvent
{
wheelDeltaY
:
number
;
wheelDeltaX
:
number
;
}
interface
IGeckoMouseWheelEvent
{
HORIZONTAL_AXIS
:
number
;
VERTICAL_AXIS
:
number
;
axis
:
number
;
detail
:
number
;
}
export
class
StandardWheelEvent
{
export
class
StandardMouseWheelEvent
{
public
readonly
browserEvent
:
MouseWheelEvent
|
null
;
public
readonly
browserEvent
:
WheelEvent
|
null
;
public
readonly
deltaY
:
number
;
public
readonly
deltaX
:
number
;
public
readonly
target
:
Node
;
constructor
(
e
:
Mouse
WheelEvent
|
null
,
deltaX
:
number
=
0
,
deltaY
:
number
=
0
)
{
constructor
(
e
:
WheelEvent
|
null
,
deltaX
:
number
=
0
,
deltaY
:
number
=
0
)
{
this
.
browserEvent
=
e
||
null
;
this
.
target
=
e
?
(
e
.
target
||
(
<
any
>
e
).
targetNode
||
e
.
srcElement
)
:
null
;
...
...
@@ -141,30 +127,12 @@ export class StandardMouseWheelEvent {
this
.
deltaX
=
deltaX
;
if
(
e
)
{
let
e1
=
<
IWebKitMouseWheelEvent
><
any
>
e
;
let
e2
=
<
IGeckoMouseWheelEvent
><
any
>
e
;
// vertical delta scroll
if
(
typeof
e1
.
wheelDeltaY
!==
'
undefined
'
)
{
this
.
deltaY
=
e1
.
wheelDeltaY
/
120
;
}
else
if
(
typeof
e2
.
VERTICAL_AXIS
!==
'
undefined
'
&&
e2
.
axis
===
e2
.
VERTICAL_AXIS
)
{
this
.
deltaY
=
-
e2
.
detail
/
3
;
}
// horizontal delta scroll
if
(
typeof
e1
.
wheelDeltaX
!==
'
undefined
'
)
{
if
(
browser
.
isSafari
&&
platform
.
isWindows
)
{
this
.
deltaX
=
-
(
e1
.
wheelDeltaX
/
120
);
}
else
{
this
.
deltaX
=
e1
.
wheelDeltaX
/
120
;
}
}
else
if
(
typeof
e2
.
HORIZONTAL_AXIS
!==
'
undefined
'
&&
e2
.
axis
===
e2
.
HORIZONTAL_AXIS
)
{
this
.
deltaX
=
-
e
.
detail
/
3
;
}
// Assume a vertical scroll if nothing else worked
if
(
this
.
deltaY
===
0
&&
this
.
deltaX
===
0
&&
e
.
wheelDelta
)
{
this
.
deltaY
=
e
.
wheelDelta
/
120
;
if
(
e
.
deltaMode
===
e
.
DOM_DELTA_LINE
)
{
this
.
deltaX
=
-
e
.
deltaX
/
3
;
this
.
deltaY
=
-
e
.
deltaY
/
3
;
}
else
if
(
e
.
deltaMode
===
e
.
DOM_DELTA_PIXEL
)
{
this
.
deltaX
=
-
e
.
deltaX
/
120
;
this
.
deltaY
=
-
e
.
deltaY
/
120
;
}
}
}
...
...
@@ -184,4 +152,4 @@ export class StandardMouseWheelEvent {
}
}
}
}
\ No newline at end of file
}
src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts
浏览文件 @
06a6d539
...
...
@@ -6,7 +6,7 @@
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
GlobalMouseMoveMonitor
,
IStandardMouseMoveEventData
,
standardMouseMoveMerger
}
from
'
vs/base/browser/globalMouseMoveMonitor
'
;
import
{
IMouseEvent
,
Standard
Mouse
WheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IMouseEvent
,
StandardWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
ScrollbarArrow
,
ScrollbarArrowOptions
}
from
'
vs/base/browser/ui/scrollbar/scrollbarArrow
'
;
import
{
ScrollbarState
}
from
'
vs/base/browser/ui/scrollbar/scrollbarState
'
;
import
{
ScrollbarVisibilityController
}
from
'
vs/base/browser/ui/scrollbar/scrollbarVisibilityController
'
;
...
...
@@ -25,7 +25,7 @@ export interface ISimplifiedMouseEvent {
}
export
interface
ScrollbarHost
{
onMouseWheel
(
mouseWheelEvent
:
Standard
Mouse
WheelEvent
):
void
;
onMouseWheel
(
mouseWheelEvent
:
StandardWheelEvent
):
void
;
onDragStart
():
void
;
onDragEnd
():
void
;
}
...
...
src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts
浏览文件 @
06a6d539
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Standard
Mouse
WheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
StandardWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
AbstractScrollbar
,
ISimplifiedMouseEvent
,
ScrollbarHost
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
ScrollableElementResolvedOptions
}
from
'
vs/base/browser/ui/scrollbar/scrollableElementOptions
'
;
import
{
ARROW_IMG_SIZE
}
from
'
vs/base/browser/ui/scrollbar/scrollbarArrow
'
;
...
...
@@ -38,7 +38,7 @@ export class HorizontalScrollbar extends AbstractScrollbar {
right
:
void
0
,
bgWidth
:
options
.
arrowSize
,
bgHeight
:
options
.
horizontalScrollbarSize
,
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
Standard
Mouse
WheelEvent
(
null
,
1
,
0
)),
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
StandardWheelEvent
(
null
,
1
,
0
)),
});
this
.
_createArrow
({
...
...
@@ -49,7 +49,7 @@ export class HorizontalScrollbar extends AbstractScrollbar {
right
:
arrowDelta
,
bgWidth
:
options
.
arrowSize
,
bgHeight
:
options
.
horizontalScrollbarSize
,
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
Standard
Mouse
WheelEvent
(
null
,
-
1
,
0
)),
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
StandardWheelEvent
(
null
,
-
1
,
0
)),
});
}
...
...
src/vs/base/browser/ui/scrollbar/scrollableElement.ts
浏览文件 @
06a6d539
...
...
@@ -6,7 +6,7 @@
import
'
vs/css!./media/scrollbars
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
IMouseEvent
,
Standard
Mouse
WheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IMouseEvent
,
StandardWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
ScrollbarHost
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
HorizontalScrollbar
}
from
'
vs/base/browser/ui/scrollbar/horizontalScrollbar
'
;
import
{
ScrollableElementChangeOptions
,
ScrollableElementCreationOptions
,
ScrollableElementResolvedOptions
}
from
'
vs/base/browser/ui/scrollbar/scrollableElementOptions
'
;
...
...
@@ -178,7 +178,7 @@ export abstract class AbstractScrollableElement extends Widget {
}));
let
scrollbarHost
:
ScrollbarHost
=
{
onMouseWheel
:
(
mouseWheelEvent
:
Standard
Mouse
WheelEvent
)
=>
this
.
_onMouseWheel
(
mouseWheelEvent
),
onMouseWheel
:
(
mouseWheelEvent
:
StandardWheelEvent
)
=>
this
.
_onMouseWheel
(
mouseWheelEvent
),
onDragStart
:
()
=>
this
.
_onDragStart
(),
onDragEnd
:
()
=>
this
.
_onDragEnd
(),
};
...
...
@@ -307,17 +307,15 @@ export abstract class AbstractScrollableElement extends Widget {
// Start listening (if necessary)
if
(
shouldListen
)
{
let
onMouseWheel
=
(
browserEvent
:
MouseWheelEvent
)
=>
{
let
e
=
new
StandardMouseWheelEvent
(
browserEvent
);
this
.
_onMouseWheel
(
e
);
let
onMouseWheel
=
(
browserEvent
:
WheelEvent
)
=>
{
this
.
_onMouseWheel
(
new
StandardWheelEvent
(
browserEvent
));
};
this
.
_mouseWheelToDispose
.
push
(
dom
.
addDisposableListener
(
this
.
_listenOnDomNode
,
'
mousewheel
'
,
onMouseWheel
));
this
.
_mouseWheelToDispose
.
push
(
dom
.
addDisposableListener
(
this
.
_listenOnDomNode
,
'
DOMMouseScroll
'
,
onMouseWheel
));
this
.
_mouseWheelToDispose
.
push
(
dom
.
addDisposableListener
(
this
.
_listenOnDomNode
,
'
wheel
'
,
onMouseWheel
));
}
}
private
_onMouseWheel
(
e
:
Standard
Mouse
WheelEvent
):
void
{
private
_onMouseWheel
(
e
:
StandardWheelEvent
):
void
{
const
classifier
=
MouseWheelClassifier
.
INSTANCE
;
if
(
SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED
)
{
...
...
src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts
浏览文件 @
06a6d539
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Standard
Mouse
WheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
StandardWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
AbstractScrollbar
,
ISimplifiedMouseEvent
,
ScrollbarHost
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
ScrollableElementResolvedOptions
}
from
'
vs/base/browser/ui/scrollbar/scrollableElementOptions
'
;
import
{
ARROW_IMG_SIZE
}
from
'
vs/base/browser/ui/scrollbar/scrollbarArrow
'
;
...
...
@@ -39,7 +39,7 @@ export class VerticalScrollbar extends AbstractScrollbar {
right
:
void
0
,
bgWidth
:
options
.
verticalScrollbarSize
,
bgHeight
:
options
.
arrowSize
,
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
Standard
Mouse
WheelEvent
(
null
,
0
,
1
)),
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
StandardWheelEvent
(
null
,
0
,
1
)),
});
this
.
_createArrow
({
...
...
@@ -50,7 +50,7 @@ export class VerticalScrollbar extends AbstractScrollbar {
right
:
void
0
,
bgWidth
:
options
.
verticalScrollbarSize
,
bgHeight
:
options
.
arrowSize
,
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
Standard
Mouse
WheelEvent
(
null
,
0
,
-
1
)),
onActivate
:
()
=>
this
.
_host
.
onMouseWheel
(
new
StandardWheelEvent
(
null
,
0
,
-
1
)),
});
}
...
...
src/vs/editor/browser/controller/mouseHandler.ts
浏览文件 @
06a6d539
...
...
@@ -5,7 +5,7 @@
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
Standard
Mouse
WheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
StandardWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
RunOnceScheduler
,
TimeoutTimer
}
from
'
vs/base/common/async
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
...
...
@@ -108,11 +108,11 @@ export class MouseHandler extends ViewEventHandler {
this
.
_register
(
mouseEvents
.
onMouseDown
(
this
.
viewHelper
.
viewDomNode
,
(
e
)
=>
this
.
_onMouseDown
(
e
)));
let
onMouseWheel
=
(
browserEvent
:
Mouse
WheelEvent
)
=>
{
let
onMouseWheel
=
(
browserEvent
:
WheelEvent
)
=>
{
if
(
!
this
.
_context
.
configuration
.
editor
.
viewInfo
.
mouseWheelZoom
)
{
return
;
}
let
e
=
new
Standard
Mouse
WheelEvent
(
browserEvent
);
let
e
=
new
StandardWheelEvent
(
browserEvent
);
if
(
e
.
browserEvent
!
.
ctrlKey
||
e
.
browserEvent
!
.
metaKey
)
{
let
zoomLevel
:
number
=
EditorZoom
.
getZoomLevel
();
let
delta
=
e
.
deltaY
>
0
?
1
:
-
1
;
...
...
@@ -121,8 +121,7 @@ export class MouseHandler extends ViewEventHandler {
e
.
stopPropagation
();
}
};
this
.
_register
(
dom
.
addDisposableListener
(
this
.
viewHelper
.
viewDomNode
,
'
mousewheel
'
,
onMouseWheel
,
true
));
this
.
_register
(
dom
.
addDisposableListener
(
this
.
viewHelper
.
viewDomNode
,
'
DOMMouseScroll
'
,
onMouseWheel
,
true
));
this
.
_register
(
dom
.
addDisposableListener
(
this
.
viewHelper
.
viewDomNode
,
'
wheel
'
,
onMouseWheel
,
true
));
this
.
_context
.
addEventHandler
(
this
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录