scrollableElementOptions.ts 3.9 KB
Newer Older
A
Alex Dima 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

J
Johannes Rieken 已提交
6
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
A
Alex Dima 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

export interface ScrollableElementCreationOptions {
	/**
	 * The scrollable element should not do any DOM mutations until renderNow() is called.
	 * Defaults to false.
	 */
	lazyRender?: boolean;
	/**
	 * CSS Class name for the scrollable element.
	 */
	className?: string;
	/**
	 * Drop subtle horizontal and vertical shadows.
	 * Defaults to false.
	 */
	useShadows?: boolean;
	/**
	 * Handle mouse wheel (listen to mouse wheel scrolling).
	 * Defaults to true
	 */
	handleMouseWheel?: boolean;
28 29 30 31 32
	/**
	 * If mouse wheel is handled, make mouse wheel scrolling smooth.
	 * Defaults to true.
	 */
	mouseWheelSmoothScroll?: boolean;
A
Alex Dima 已提交
33 34
	/**
	 * Flip axes. Treat vertical scrolling like horizontal and vice-versa.
35
	 * Defaults to false.
A
Alex Dima 已提交
36 37
	 */
	flipAxes?: boolean;
38 39 40 41 42
	/**
	 * If enabled, will scroll horizontally when scrolling vertical.
	 * Defaults to false.
	 */
	scrollYToX?: boolean;
43 44 45 46 47
	/**
	 * Always consume mouse wheel events, even when scrolling is no longer possible.
	 * Defaults to false.
	 */
	alwaysConsumeMouseWheel?: boolean;
A
Alex Dima 已提交
48 49 50 51 52
	/**
	 * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
	 * Defaults to 1.
	 */
	mouseWheelScrollSensitivity?: number;
T
Tiago Ribeiro 已提交
53
	/**
54 55
	 * FastScrolling mulitplier speed when pressing `Alt`
	 * Defaults to 5.
T
Tiago Ribeiro 已提交
56 57
	 */
	fastScrollSensitivity?: number;
A
Alex Dima 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
	/**
	 * Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right).
	 * Defaults to 11.
	 */
	arrowSize?: number;
	/**
	 * The dom node events should be bound to.
	 * If no listenOnDomNode is provided, the dom node passed to the constructor will be used for event listening.
	 */
	listenOnDomNode?: HTMLElement;
	/**
	 * Control the visibility of the horizontal scrollbar.
	 * Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible)
	 * Defaults to 'auto'.
	 */
A
Alex Dima 已提交
73
	horizontal?: ScrollbarVisibility;
A
Alex Dima 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
	/**
	 * Height (in px) of the horizontal scrollbar.
	 * Defaults to 10.
	 */
	horizontalScrollbarSize?: number;
	/**
	 * Height (in px) of the horizontal scrollbar slider.
	 * Defaults to `horizontalScrollbarSize`
	 */
	horizontalSliderSize?: number;
	/**
	 * Render arrows (left/right) for the horizontal scrollbar.
	 * Defaults to false.
	 */
	horizontalHasArrows?: boolean;
	/**
	 * Control the visibility of the vertical scrollbar.
	 * Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible)
	 * Defaults to 'auto'.
	 */
A
Alex Dima 已提交
94
	vertical?: ScrollbarVisibility;
A
Alex Dima 已提交
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
	/**
	 * Width (in px) of the vertical scrollbar.
	 * Defaults to 10.
	 */
	verticalScrollbarSize?: number;
	/**
	 * Width (in px) of the vertical scrollbar slider.
	 * Defaults to `verticalScrollbarSize`
	 */
	verticalSliderSize?: number;
	/**
	 * Render arrows (top/bottom) for the vertical scrollbar.
	 * Defaults to false.
	 */
	verticalHasArrows?: boolean;
}

112 113 114
export interface ScrollableElementChangeOptions {
	handleMouseWheel?: boolean;
	mouseWheelScrollSensitivity?: number;
T
Tiago Ribeiro 已提交
115
	fastScrollSensitivity: number;
116 117
}

A
Alex Dima 已提交
118 119 120 121 122 123
export interface ScrollableElementResolvedOptions {
	lazyRender: boolean;
	className: string;
	useShadows: boolean;
	handleMouseWheel: boolean;
	flipAxes: boolean;
124
	scrollYToX: boolean;
125
	alwaysConsumeMouseWheel: boolean;
A
Alex Dima 已提交
126
	mouseWheelScrollSensitivity: number;
T
Tiago Ribeiro 已提交
127
	fastScrollSensitivity: number;
128
	mouseWheelSmoothScroll: boolean;
A
Alex Dima 已提交
129
	arrowSize: number;
A
Alex Dima 已提交
130
	listenOnDomNode: HTMLElement | null;
A
Alex Dima 已提交
131
	horizontal: ScrollbarVisibility;
A
Alex Dima 已提交
132 133 134
	horizontalScrollbarSize: number;
	horizontalSliderSize: number;
	horizontalHasArrows: boolean;
A
Alex Dima 已提交
135
	vertical: ScrollbarVisibility;
A
Alex Dima 已提交
136 137 138 139
	verticalScrollbarSize: number;
	verticalSliderSize: number;
	verticalHasArrows: boolean;
}