| 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 'vs/base/common/scrollable'; |
| 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 |
* Flip axes. Treat vertical scrolling like horizontal and vice-versa. |
| 35 |
* Defaults to false. |
| 36 |
*/ |
| 37 |
flipAxes?: boolean; |
| 38 |
/** |
| 39 |
* If enabled, will scroll horizontally when scrolling vertical. |
| 40 |
* Defaults to false. |
| 41 |
*/ |
| 42 |
scrollYToX?: boolean; |
| 43 |
/** |
| 44 |
* Consume all mouse wheel events if a scrollbar is needed (i.e. scrollSize > size). |
| 45 |
* Defaults to false. |
| 46 |
*/ |
| 47 |
consumeMouseWheelIfScrollbarIsNeeded?: boolean; |
| 48 |
/** |
| 49 |
* Always consume mouse wheel events, even when scrolling is no longer possible. |
| 50 |
* Defaults to false. |
| 51 |
*/ |
| 52 |
alwaysConsumeMouseWheel?: boolean; |
| 53 |
/** |
| 54 |
* A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. |
| 55 |
* Defaults to 1. |
| 56 |
*/ |
| 57 |
mouseWheelScrollSensitivity?: number; |
| 58 |
/** |
| 59 |
* FastScrolling mulitplier speed when pressing `Alt` |
| 60 |
* Defaults to 5. |
| 61 |
*/ |
| 62 |
fastScrollSensitivity?: number; |
| 63 |
/** |
| 64 |
* Whether the scrollable will only scroll along the predominant axis when scrolling both |
| 65 |
* vertically and horizontally at the same time. |
| 66 |
* Prevents horizontal drift when scrolling vertically on a trackpad. |
| 67 |
* Defaults to true. |
| 68 |
*/ |
| 69 |
scrollPredominantAxis?: boolean; |
| 70 |
/** |
| 71 |
* Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right). |
| 72 |
* Defaults to 11. |
| 73 |
*/ |
| 74 |
arrowSize?: number; |
| 75 |
/** |
| 76 |
* The dom node events should be bound to. |
| 77 |
* If no listenOnDomNode is provided, the dom node passed to the constructor will be used for event listening. |
| 78 |
*/ |
| 79 |
listenOnDomNode?: HTMLElement; |
| 80 |
/** |
| 81 |
* Control the visibility of the horizontal scrollbar. |
| 82 |
* Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible) |
| 83 |
* Defaults to 'auto'. |
| 84 |
*/ |
| 85 |
horizontal?: ScrollbarVisibility; |
| 86 |
/** |
| 87 |
* Height (in px) of the horizontal scrollbar. |
| 88 |
* Defaults to 10. |
| 89 |
*/ |
| 90 |
horizontalScrollbarSize?: number; |
| 91 |
/** |
| 92 |
* Height (in px) of the horizontal scrollbar slider. |
| 93 |
* Defaults to `horizontalScrollbarSize` |
| 94 |
*/ |
| 95 |
horizontalSliderSize?: number; |
| 96 |
/** |
| 97 |
* Render arrows (left/right) for the horizontal scrollbar. |
| 98 |
* Defaults to false. |
| 99 |
*/ |
| 100 |
horizontalHasArrows?: boolean; |
| 101 |
/** |
| 102 |
* Control the visibility of the vertical scrollbar. |
| 103 |
* Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible) |
| 104 |
* Defaults to 'auto'. |
| 105 |
*/ |
| 106 |
vertical?: ScrollbarVisibility; |
| 107 |
/** |
| 108 |
* Width (in px) of the vertical scrollbar. |
| 109 |
* Defaults to 10. |
| 110 |
*/ |
| 111 |
verticalScrollbarSize?: number; |
| 112 |
/** |
| 113 |
* Width (in px) of the vertical scrollbar slider. |
| 114 |
* Defaults to `verticalScrollbarSize` |
| 115 |
*/ |
| 116 |
verticalSliderSize?: number; |
| 117 |
/** |
| 118 |
* Render arrows (top/bottom) for the vertical scrollbar. |
| 119 |
* Defaults to false. |
| 120 |
*/ |
| 121 |
verticalHasArrows?: boolean; |
| 122 |
/** |
| 123 |
* Scroll gutter clicks move by page vs. jump to position. |
| 124 |
* Defaults to false. |
| 125 |
*/ |
| 126 |
scrollByPage?: boolean; |
| 127 |
} |
| 128 |
|
| 129 |
export interface ScrollableElementChangeOptions { |
| 130 |
handleMouseWheel?: boolean; |
| 131 |
mouseWheelScrollSensitivity?: number; |
| 132 |
fastScrollSensitivity?: number; |
| 133 |
scrollPredominantAxis?: boolean; |
| 134 |
horizontal?: ScrollbarVisibility; |
| 135 |
horizontalScrollbarSize?: number; |
| 136 |
vertical?: ScrollbarVisibility; |
| 137 |
verticalScrollbarSize?: number; |
| 138 |
scrollByPage?: boolean; |
| 139 |
} |
| 140 |
|
| 141 |
export interface ScrollableElementResolvedOptions { |
| 142 |
lazyRender: boolean; |
| 143 |
className: string; |
| 144 |
useShadows: boolean; |
| 145 |
handleMouseWheel: boolean; |
| 146 |
flipAxes: boolean; |
| 147 |
scrollYToX: boolean; |
| 148 |
consumeMouseWheelIfScrollbarIsNeeded: boolean; |
| 149 |
alwaysConsumeMouseWheel: boolean; |
| 150 |
mouseWheelScrollSensitivity: number; |
| 151 |
fastScrollSensitivity: number; |
| 152 |
scrollPredominantAxis: boolean; |
| 153 |
mouseWheelSmoothScroll: boolean; |
| 154 |
arrowSize: number; |
| 155 |
listenOnDomNode: HTMLElement | null; |
| 156 |
horizontal: ScrollbarVisibility; |
| 157 |
horizontalScrollbarSize: number; |
| 158 |
horizontalSliderSize: number; |
| 159 |
horizontalHasArrows: boolean; |
| 160 |
vertical: ScrollbarVisibility; |
| 161 |
verticalScrollbarSize: number; |
| 162 |
verticalSliderSize: number; |
| 163 |
verticalHasArrows: boolean; |
| 164 |
scrollByPage: boolean; |
| 165 |
} |