Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a322bf08
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,发现更多精彩内容 >>
提交
a322bf08
编写于
4月 29, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract ScrollbarArrow to its own file
上级
8120b8f4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
117 addition
and
104 deletion
+117
-104
src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts
src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts
+3
-102
src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts
src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts
+3
-1
src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts
src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts
+108
-0
src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts
src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts
+3
-1
未找到文件。
src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts
浏览文件 @
a322bf08
...
...
@@ -8,95 +8,20 @@ import * as Browser from 'vs/base/browser/browser';
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
*
as
DomUtils
from
'
vs/base/browser/dom
'
;
import
{
IMouseEvent
,
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
I
MouseWheelEvent
,
I
Parent
,
Visibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
IParent
,
Visibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
GlobalMouseMoveMonitor
,
IStandardMouseMoveEventData
,
standardMouseMoveMerger
}
from
'
vs/base/browser/globalMouseMoveMonitor
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
TimeoutTimer
,
IntervalTimer
}
from
'
vs/base/common/async
'
;
import
{
TimeoutTimer
}
from
'
vs/base/common/async
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
{
ScrollbarState
}
from
'
vs/base/browser/ui/scrollbar/scrollbarState
'
;
/**
* The arrow image size.
*/
export
const
ARROW_IMG_SIZE
=
11
;
import
{
ScrollbarArrow
,
IMouseWheelEventFactory
}
from
'
vs/base/browser/ui/scrollbar/scrollbarArrow
'
;
/**
* The orthogonal distance to the slider at which dragging "resets". This implements "snapping"
*/
const
MOUSE_DRAG_RESET_DISTANCE
=
140
;
export
interface
IMouseWheelEventFactory
{
():
IMouseWheelEvent
;
}
class
ScrollbarArrow
extends
Widget
{
private
_parent
:
IParent
;
private
_mouseWheelEventFactory
:
IMouseWheelEventFactory
;
public
bgDomNode
:
HTMLElement
;
public
domNode
:
HTMLElement
;
private
_mousedownRepeatTimer
:
IntervalTimer
;
private
_mousedownScheduleRepeatTimer
:
TimeoutTimer
;
private
_mouseMoveMonitor
:
GlobalMouseMoveMonitor
<
IStandardMouseMoveEventData
>
;
constructor
(
className
:
string
,
top
:
number
,
left
:
number
,
bottom
:
number
,
right
:
number
,
bgWidth
:
number
,
bgHeight
:
number
,
mouseWheelEventFactory
:
IMouseWheelEventFactory
,
parent
:
IParent
)
{
super
();
this
.
_parent
=
parent
;
this
.
_mouseWheelEventFactory
=
mouseWheelEventFactory
;
this
.
bgDomNode
=
document
.
createElement
(
'
div
'
);
this
.
bgDomNode
.
className
=
'
arrow-background
'
;
this
.
bgDomNode
.
style
.
position
=
'
absolute
'
;
setSize
(
this
.
bgDomNode
,
bgWidth
,
bgHeight
);
setPosition
(
this
.
bgDomNode
,
(
top
!==
null
?
0
:
null
),
(
left
!==
null
?
0
:
null
),
(
bottom
!==
null
?
0
:
null
),
(
right
!==
null
?
0
:
null
));
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
.
className
=
className
;
this
.
domNode
.
style
.
position
=
'
absolute
'
;
setSize
(
this
.
domNode
,
ARROW_IMG_SIZE
,
ARROW_IMG_SIZE
);
setPosition
(
this
.
domNode
,
top
,
left
,
bottom
,
right
);
this
.
_mouseMoveMonitor
=
this
.
_register
(
new
GlobalMouseMoveMonitor
<
IStandardMouseMoveEventData
>
());
this
.
onmousedown
(
this
.
bgDomNode
,
(
e
)
=>
this
.
_arrowMouseDown
(
e
));
this
.
onmousedown
(
this
.
domNode
,
(
e
)
=>
this
.
_arrowMouseDown
(
e
));
this
.
_mousedownRepeatTimer
=
this
.
_register
(
new
IntervalTimer
());
this
.
_mousedownScheduleRepeatTimer
=
this
.
_register
(
new
TimeoutTimer
());
}
private
_arrowMouseDown
(
e
:
IMouseEvent
):
void
{
let
repeater
=
()
=>
{
this
.
_parent
.
onMouseWheel
(
this
.
_mouseWheelEventFactory
());
};
let
scheduleRepeater
=
()
=>
{
this
.
_mousedownRepeatTimer
.
cancelAndSet
(
repeater
,
1000
/
24
);
};
repeater
();
this
.
_mousedownRepeatTimer
.
cancel
();
this
.
_mousedownScheduleRepeatTimer
.
cancelAndSet
(
scheduleRepeater
,
200
);
this
.
_mouseMoveMonitor
.
startMonitoring
(
standardMouseMoveMerger
,
(
mouseMoveData
:
IStandardMouseMoveEventData
)
=>
{
/* Intentional empty */
},
()
=>
{
this
.
_mousedownRepeatTimer
.
cancel
();
this
.
_mousedownScheduleRepeatTimer
.
cancel
();
}
);
e
.
preventDefault
();
}
}
class
VisibilityController
extends
Disposable
{
private
_visibility
:
Visibility
;
private
_visibleClassName
:
string
;
...
...
@@ -413,27 +338,3 @@ export abstract class AbstractScrollbar extends Widget {
protected
abstract
_getScrollPosition
():
number
;
protected
abstract
_setScrollPosition
(
elementScrollPosition
:
number
):
void
;
}
function
setPosition
(
domNode
:
HTMLElement
,
top
:
number
,
left
:
number
,
bottom
:
number
,
right
:
number
)
{
if
(
top
!==
null
)
{
domNode
.
style
.
top
=
top
+
'
px
'
;
}
if
(
left
!==
null
)
{
domNode
.
style
.
left
=
left
+
'
px
'
;
}
if
(
bottom
!==
null
)
{
domNode
.
style
.
bottom
=
bottom
+
'
px
'
;
}
if
(
right
!==
null
)
{
domNode
.
style
.
right
=
right
+
'
px
'
;
}
}
function
setSize
(
domNode
:
HTMLElement
,
width
:
number
,
height
:
number
)
{
if
(
width
!==
null
)
{
domNode
.
style
.
width
=
width
+
'
px
'
;
}
if
(
height
!==
null
)
{
domNode
.
style
.
height
=
height
+
'
px
'
;
}
}
src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts
浏览文件 @
a322bf08
...
...
@@ -5,11 +5,13 @@
'
use strict
'
;
import
*
as
Browser
from
'
vs/base/browser/browser
'
;
import
{
A
RROW_IMG_SIZE
,
AbstractScrollbar
,
ScrollbarState
,
IMouseMoveEventData
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
A
bstractScrollbar
,
IMouseMoveEventData
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
IMouseEvent
,
StandardMouseWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IDomNodePosition
}
from
'
vs/base/browser/dom
'
;
import
{
IParent
,
IScrollableElementOptions
,
Visibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
DelegateScrollable
}
from
'
vs/base/common/scrollable
'
;
import
{
ScrollbarState
}
from
'
vs/base/browser/ui/scrollbar/scrollbarState
'
;
import
{
ARROW_IMG_SIZE
}
from
'
vs/base/browser/ui/scrollbar/scrollbarArrow
'
;
export
class
HorizontalScrollbar
extends
AbstractScrollbar
{
...
...
src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts
0 → 100644
浏览文件 @
a322bf08
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IMouseWheelEvent
,
IParent
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
GlobalMouseMoveMonitor
,
IStandardMouseMoveEventData
,
standardMouseMoveMerger
}
from
'
vs/base/browser/globalMouseMoveMonitor
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
TimeoutTimer
,
IntervalTimer
}
from
'
vs/base/common/async
'
;
export
interface
IMouseWheelEventFactory
{
():
IMouseWheelEvent
;
}
/**
* The arrow image size.
*/
export
const
ARROW_IMG_SIZE
=
11
;
export
class
ScrollbarArrow
extends
Widget
{
private
_parent
:
IParent
;
private
_mouseWheelEventFactory
:
IMouseWheelEventFactory
;
public
bgDomNode
:
HTMLElement
;
public
domNode
:
HTMLElement
;
private
_mousedownRepeatTimer
:
IntervalTimer
;
private
_mousedownScheduleRepeatTimer
:
TimeoutTimer
;
private
_mouseMoveMonitor
:
GlobalMouseMoveMonitor
<
IStandardMouseMoveEventData
>
;
constructor
(
className
:
string
,
top
:
number
,
left
:
number
,
bottom
:
number
,
right
:
number
,
bgWidth
:
number
,
bgHeight
:
number
,
mouseWheelEventFactory
:
IMouseWheelEventFactory
,
parent
:
IParent
)
{
super
();
this
.
_parent
=
parent
;
this
.
_mouseWheelEventFactory
=
mouseWheelEventFactory
;
this
.
bgDomNode
=
document
.
createElement
(
'
div
'
);
this
.
bgDomNode
.
className
=
'
arrow-background
'
;
this
.
bgDomNode
.
style
.
position
=
'
absolute
'
;
setSize
(
this
.
bgDomNode
,
bgWidth
,
bgHeight
);
setPosition
(
this
.
bgDomNode
,
(
top
!==
null
?
0
:
null
),
(
left
!==
null
?
0
:
null
),
(
bottom
!==
null
?
0
:
null
),
(
right
!==
null
?
0
:
null
));
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
.
className
=
className
;
this
.
domNode
.
style
.
position
=
'
absolute
'
;
setSize
(
this
.
domNode
,
ARROW_IMG_SIZE
,
ARROW_IMG_SIZE
);
setPosition
(
this
.
domNode
,
top
,
left
,
bottom
,
right
);
this
.
_mouseMoveMonitor
=
this
.
_register
(
new
GlobalMouseMoveMonitor
<
IStandardMouseMoveEventData
>
());
this
.
onmousedown
(
this
.
bgDomNode
,
(
e
)
=>
this
.
_arrowMouseDown
(
e
));
this
.
onmousedown
(
this
.
domNode
,
(
e
)
=>
this
.
_arrowMouseDown
(
e
));
this
.
_mousedownRepeatTimer
=
this
.
_register
(
new
IntervalTimer
());
this
.
_mousedownScheduleRepeatTimer
=
this
.
_register
(
new
TimeoutTimer
());
}
private
_arrowMouseDown
(
e
:
IMouseEvent
):
void
{
let
repeater
=
()
=>
{
this
.
_parent
.
onMouseWheel
(
this
.
_mouseWheelEventFactory
());
};
let
scheduleRepeater
=
()
=>
{
this
.
_mousedownRepeatTimer
.
cancelAndSet
(
repeater
,
1000
/
24
);
};
repeater
();
this
.
_mousedownRepeatTimer
.
cancel
();
this
.
_mousedownScheduleRepeatTimer
.
cancelAndSet
(
scheduleRepeater
,
200
);
this
.
_mouseMoveMonitor
.
startMonitoring
(
standardMouseMoveMerger
,
(
mouseMoveData
:
IStandardMouseMoveEventData
)
=>
{
/* Intentional empty */
},
()
=>
{
this
.
_mousedownRepeatTimer
.
cancel
();
this
.
_mousedownScheduleRepeatTimer
.
cancel
();
}
);
e
.
preventDefault
();
}
}
function
setPosition
(
domNode
:
HTMLElement
,
top
:
number
,
left
:
number
,
bottom
:
number
,
right
:
number
)
{
if
(
top
!==
null
)
{
domNode
.
style
.
top
=
top
+
'
px
'
;
}
if
(
left
!==
null
)
{
domNode
.
style
.
left
=
left
+
'
px
'
;
}
if
(
bottom
!==
null
)
{
domNode
.
style
.
bottom
=
bottom
+
'
px
'
;
}
if
(
right
!==
null
)
{
domNode
.
style
.
right
=
right
+
'
px
'
;
}
}
function
setSize
(
domNode
:
HTMLElement
,
width
:
number
,
height
:
number
)
{
if
(
width
!==
null
)
{
domNode
.
style
.
width
=
width
+
'
px
'
;
}
if
(
height
!==
null
)
{
domNode
.
style
.
height
=
height
+
'
px
'
;
}
}
src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts
浏览文件 @
a322bf08
...
...
@@ -5,11 +5,13 @@
'
use strict
'
;
import
*
as
Browser
from
'
vs/base/browser/browser
'
;
import
{
A
RROW_IMG_SIZE
,
AbstractScrollbar
,
ScrollbarState
,
IMouseMoveEventData
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
A
bstractScrollbar
,
IMouseMoveEventData
}
from
'
vs/base/browser/ui/scrollbar/abstractScrollbar
'
;
import
{
IMouseEvent
,
StandardMouseWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IDomNodePosition
}
from
'
vs/base/browser/dom
'
;
import
{
IParent
,
IScrollableElementOptions
,
Visibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
DelegateScrollable
}
from
'
vs/base/common/scrollable
'
;
import
{
ScrollbarState
}
from
'
vs/base/browser/ui/scrollbar/scrollbarState
'
;
import
{
ARROW_IMG_SIZE
}
from
'
vs/base/browser/ui/scrollbar/scrollbarArrow
'
;
export
class
VerticalScrollbar
extends
AbstractScrollbar
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录