forked from idiotWu/smooth-scrollbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.ts
63 lines (54 loc) · 1.33 KB
/
options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {
range,
boolean,
} from './decorators/';
import {
ScrollbarOptions,
} from './interfaces/';
export class Options {
/**
* Momentum reduction damping factor, a float value between `(0, 1)`.
* The lower the value is, the more smooth the scrolling will be
* (also the more paint frames).
*/
@range(0, 1)
damping = 0.1;
/**
* Minimal size for scrollbar thumbs.
*/
@range(0, Infinity)
thumbMinSize = 20;
/**
* Render every frame in integer pixel values
* set to `true` to improve scrolling performance.
*/
@boolean
renderByPixels = true;
/**
* Keep scrollbar tracks visible
*/
@boolean
alwaysShowTracks = false;
/**
* Set to `true` to allow outer scrollbars continue scrolling
* when current scrollbar reaches edge.
*/
@boolean
continuousScrolling = true;
/**
* Element to be used as a listener for mouse wheel scroll events.
* By default, the container element is used.
* This option will be useful for dealing with fixed elements.
*/
wheelEventTarget: EventTarget | null = null;
/**
* Options for plugins. Syntax:
* plugins[pluginName] = pluginOptions: any
*/
readonly plugins: any = {};
constructor(config: Partial<ScrollbarOptions> = {}) {
Object.keys(config).forEach((prop) => {
this[prop] = config[prop];
});
}
}