Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ScrollbarVisibility } from '../../../common/scrollable.js';
7
8
export interface ScrollableElementCreationOptions {
9
/**
10
* The scrollable element should not do any DOM mutations until renderNow() is called.
11
* Defaults to false.
12
*/
13
lazyRender?: boolean;
14
/**
15
* CSS Class name for the scrollable element.
16
*/
17
className?: string;
18
/**
19
* Drop subtle horizontal and vertical shadows.
20
* Defaults to false.
21
*/
22
useShadows?: boolean;
23
/**
24
* Handle mouse wheel (listen to mouse wheel scrolling).
25
* Defaults to true
26
*/
27
handleMouseWheel?: boolean;
28
/**
29
* If mouse wheel is handled, make mouse wheel scrolling smooth.
30
* Defaults to true.
31
*/
32
mouseWheelSmoothScroll?: boolean;
33
/**
34
* Make scrolling inertial - mostly useful with touchpad on linux.
35
*/
36
inertialScroll?: boolean;
37
/**
38
* Flip axes. Treat vertical scrolling like horizontal and vice-versa.
39
* Defaults to false.
40
*/
41
flipAxes?: boolean;
42
/**
43
* If enabled, will scroll horizontally when scrolling vertical.
44
* Defaults to false.
45
*/
46
scrollYToX?: boolean;
47
/**
48
* Consume all mouse wheel events if a scrollbar is needed (i.e. scrollSize > size).
49
* Defaults to false.
50
*/
51
consumeMouseWheelIfScrollbarIsNeeded?: boolean;
52
/**
53
* Always consume mouse wheel events, even when scrolling is no longer possible.
54
* Defaults to false.
55
*/
56
alwaysConsumeMouseWheel?: boolean;
57
/**
58
* A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
59
* Defaults to 1.
60
*/
61
mouseWheelScrollSensitivity?: number;
62
/**
63
* FastScrolling mulitplier speed when pressing `Alt`
64
* Defaults to 5.
65
*/
66
fastScrollSensitivity?: number;
67
/**
68
* Whether the scrollable will only scroll along the predominant axis when scrolling both
69
* vertically and horizontally at the same time.
70
* Prevents horizontal drift when scrolling vertically on a trackpad.
71
* Defaults to true.
72
*/
73
scrollPredominantAxis?: boolean;
74
/**
75
* Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right).
76
* Defaults to 11.
77
*/
78
arrowSize?: number;
79
/**
80
* The dom node events should be bound to.
81
* If no listenOnDomNode is provided, the dom node passed to the constructor will be used for event listening.
82
*/
83
listenOnDomNode?: HTMLElement;
84
/**
85
* Control the visibility of the horizontal scrollbar.
86
* Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible)
87
* Defaults to 'auto'.
88
*/
89
horizontal?: ScrollbarVisibility;
90
/**
91
* Height (in px) of the horizontal scrollbar.
92
* Defaults to 10.
93
*/
94
horizontalScrollbarSize?: number;
95
/**
96
* Height (in px) of the horizontal scrollbar slider.
97
* Defaults to `horizontalScrollbarSize`
98
*/
99
horizontalSliderSize?: number;
100
/**
101
* Render arrows (left/right) for the horizontal scrollbar.
102
* Defaults to false.
103
*/
104
horizontalHasArrows?: boolean;
105
/**
106
* Control the visibility of the vertical scrollbar.
107
* Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible)
108
* Defaults to 'auto'.
109
*/
110
vertical?: ScrollbarVisibility;
111
/**
112
* Width (in px) of the vertical scrollbar.
113
* Defaults to 10.
114
*/
115
verticalScrollbarSize?: number;
116
/**
117
* Width (in px) of the vertical scrollbar slider.
118
* Defaults to `verticalScrollbarSize`
119
*/
120
verticalSliderSize?: number;
121
/**
122
* Render arrows (top/bottom) for the vertical scrollbar.
123
* Defaults to false.
124
*/
125
verticalHasArrows?: boolean;
126
/**
127
* Scroll gutter clicks move by page vs. jump to position.
128
* Defaults to false.
129
*/
130
scrollByPage?: boolean;
131
}
132
133
export interface ScrollableElementChangeOptions {
134
handleMouseWheel?: boolean;
135
mouseWheelScrollSensitivity?: number;
136
fastScrollSensitivity?: number;
137
scrollPredominantAxis?: boolean;
138
horizontal?: ScrollbarVisibility;
139
horizontalScrollbarSize?: number;
140
vertical?: ScrollbarVisibility;
141
verticalScrollbarSize?: number;
142
scrollByPage?: boolean;
143
}
144
145
export interface ScrollableElementResolvedOptions {
146
lazyRender: boolean;
147
className: string;
148
useShadows: boolean;
149
handleMouseWheel: boolean;
150
flipAxes: boolean;
151
scrollYToX: boolean;
152
consumeMouseWheelIfScrollbarIsNeeded: boolean;
153
alwaysConsumeMouseWheel: boolean;
154
mouseWheelScrollSensitivity: number;
155
fastScrollSensitivity: number;
156
scrollPredominantAxis: boolean;
157
mouseWheelSmoothScroll: boolean;
158
inertialScroll: boolean;
159
arrowSize: number;
160
listenOnDomNode: HTMLElement | null;
161
horizontal: ScrollbarVisibility;
162
horizontalScrollbarSize: number;
163
horizontalSliderSize: number;
164
horizontalHasArrows: boolean;
165
vertical: ScrollbarVisibility;
166
verticalScrollbarSize: number;
167
verticalSliderSize: number;
168
verticalHasArrows: boolean;
169
scrollByPage: boolean;
170
}
171
172