176
};
177
}
179
>
}
180
>
181
>
export interface IScrollDimensions {
182
>
readonly width: number;
183
>
readonly scrollWidth: number;
184
>
readonly height: number;
185
>
readonly scrollHeight: number;
186
>
}
187
>
export interface INewScrollDimensions {
188
>
width?: number;
189
>
scrollWidth?: number;
190
>
height?: number;
191
>
scrollHeight?: number;
192
>
}
193
>
194
>
export interface IScrollPosition {
195
>
readonly scrollLeft: number;
196
>
readonly scrollTop: number;
197
>
}
198
>
export interface ISmoothScrollPosition {
199
>
readonly scrollLeft: number;
200
>
readonly scrollTop: number;
201
>
202
>
readonly width: number;
203
>
readonly height: number;
204
>
}
205
>
export interface INewScrollPosition {
206
>
scrollLeft?: number;
207
>
scrollTop?: number;
208
>
}
209
>
210
>
export interface IScrollableOptions {
211
>
/**
212
>
* Define if the scroll values should always be integers.
213
>
*/
214
>
forceIntegerValues: boolean;
215
>
/**
216
>
* Set the duration (ms) used for smooth scroll animations.
217
>
*/
218
>
smoothScrollDuration: number;
219
>
/**
220
>
* A function to schedule an update at the next frame (used for smooth scroll animations).
221
>
*/
222
>
scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;
223
>
}
224
>
225
>
export class Scrollable extends Disposable {
226
>
227
>
_scrollableBrand: void = undefined;
228
>
229
>
private _smoothScrollDuration: number;
230
>
private readonly _scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;
231
>
private _state: ScrollState;
232
>
private _smoothScrolling: SmoothScrollingOperation | null;
233
>
234
>
private _onScroll = this._register(new Emitter<ScrollEvent>());
235
>
public readonly onScroll: Event<ScrollEvent> = this._onScroll.event;
236
>
237
>
constructor(options: IScrollableOptions) {
238
super();
239