1 | import { GestureKey, EngineClass, Action } from './types'
|
---|
2 | import { ResolverMap } from './config/resolver'
|
---|
3 |
|
---|
4 | import { DragEngine } from './engines/DragEngine'
|
---|
5 | import { dragConfigResolver } from './config/dragConfigResolver'
|
---|
6 |
|
---|
7 | import { PinchEngine } from './engines/PinchEngine'
|
---|
8 | import { pinchConfigResolver } from './config/pinchConfigResolver'
|
---|
9 |
|
---|
10 | import { MoveEngine } from './engines/MoveEngine'
|
---|
11 | import { moveConfigResolver } from './config/moveConfigResolver'
|
---|
12 |
|
---|
13 | import { ScrollEngine } from './engines/ScrollEngine'
|
---|
14 | import { scrollConfigResolver } from './config/scrollConfigResolver'
|
---|
15 |
|
---|
16 | import { WheelEngine } from './engines/WheelEngine'
|
---|
17 | import { wheelConfigResolver } from './config/wheelConfigResolver'
|
---|
18 |
|
---|
19 | import { HoverEngine } from './engines/HoverEngine'
|
---|
20 | import { hoverConfigResolver } from './config/hoverConfigResolver'
|
---|
21 |
|
---|
22 | export const EngineMap = new Map<GestureKey, EngineClass<any>>()
|
---|
23 | export const ConfigResolverMap = new Map<GestureKey, ResolverMap>()
|
---|
24 |
|
---|
25 | export function registerAction(action: Action) {
|
---|
26 | EngineMap.set(action.key, action.engine)
|
---|
27 | ConfigResolverMap.set(action.key, action.resolver)
|
---|
28 | }
|
---|
29 |
|
---|
30 | export const dragAction: Action = {
|
---|
31 | key: 'drag',
|
---|
32 | engine: DragEngine as any,
|
---|
33 | resolver: dragConfigResolver
|
---|
34 | }
|
---|
35 |
|
---|
36 | export const hoverAction: Action = {
|
---|
37 | key: 'hover',
|
---|
38 | engine: HoverEngine as any,
|
---|
39 | resolver: hoverConfigResolver
|
---|
40 | }
|
---|
41 |
|
---|
42 | export const moveAction: Action = {
|
---|
43 | key: 'move',
|
---|
44 | engine: MoveEngine as any,
|
---|
45 | resolver: moveConfigResolver
|
---|
46 | }
|
---|
47 |
|
---|
48 | export const pinchAction: Action = {
|
---|
49 | key: 'pinch',
|
---|
50 | engine: PinchEngine as any,
|
---|
51 | resolver: pinchConfigResolver
|
---|
52 | }
|
---|
53 |
|
---|
54 | export const scrollAction: Action = {
|
---|
55 | key: 'scroll',
|
---|
56 | engine: ScrollEngine as any,
|
---|
57 | resolver: scrollConfigResolver
|
---|
58 | }
|
---|
59 |
|
---|
60 | export const wheelAction: Action = {
|
---|
61 | key: 'wheel',
|
---|
62 | engine: WheelEngine as any,
|
---|
63 | resolver: wheelConfigResolver
|
---|
64 | }
|
---|