1 | import { EventEmitter } from '@better-scroll/shared-utils';
|
2 | export declare type Bounces = [boolean, boolean];
|
3 | export declare type Rect = {
|
4 | size: string;
|
5 | position: string;
|
6 | };
|
7 | export interface Options {
|
8 | scrollable: boolean;
|
9 | momentum: boolean;
|
10 | momentumLimitTime: number;
|
11 | momentumLimitDistance: number;
|
12 | deceleration: number;
|
13 | swipeBounceTime: number;
|
14 | swipeTime: number;
|
15 | bounces: Bounces;
|
16 | rect: Rect;
|
17 | outOfBoundaryDampingFactor: number;
|
18 | specifiedIndexAsContent: number;
|
19 | [key: string]: number | boolean | Bounces | Rect;
|
20 | }
|
21 | export declare type Boundary = {
|
22 | minScrollPos: number;
|
23 | maxScrollPos: number;
|
24 | };
|
25 | export declare class Behavior {
|
26 | wrapper: HTMLElement;
|
27 | options: Options;
|
28 | content: HTMLElement;
|
29 | currentPos: number;
|
30 | startPos: number;
|
31 | absStartPos: number;
|
32 | dist: number;
|
33 | minScrollPos: number;
|
34 | maxScrollPos: number;
|
35 | hasScroll: boolean;
|
36 | direction: number;
|
37 | movingDirection: number;
|
38 | relativeOffset: number;
|
39 | wrapperSize: number;
|
40 | contentSize: number;
|
41 | hooks: EventEmitter;
|
42 | constructor(wrapper: HTMLElement, content: HTMLElement, options: Options);
|
43 | start(): void;
|
44 | move(delta: number): number;
|
45 | setMovingDirection(delta: number): void;
|
46 | setDirection(delta: number): void;
|
47 | performDampingAlgorithm(delta: number, dampingFactor: number): number;
|
48 | end(duration: number): {
|
49 | destination?: number | undefined;
|
50 | duration?: number | undefined;
|
51 | };
|
52 | private momentum;
|
53 | updateDirection(): void;
|
54 | refresh(content: HTMLElement): void;
|
55 | private setContent;
|
56 | private resetState;
|
57 | computeBoundary(): void;
|
58 | updatePosition(pos: number): void;
|
59 | getCurrentPos(): number;
|
60 | checkInBoundary(): {
|
61 | position: number;
|
62 | inBoundary: boolean;
|
63 | };
|
64 | adjustPosition(pos: number): number;
|
65 | updateStartPos(): void;
|
66 | updateAbsStartPos(): void;
|
67 | resetStartPos(): void;
|
68 | getAbsDist(delta: number): number;
|
69 | destroy(): void;
|
70 | }
|