-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathconstants.ts
More file actions
118 lines (104 loc) · 3.18 KB
/
Copy pathconstants.ts
File metadata and controls
118 lines (104 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// deck.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import {Pan, DoubleClickDrag, Pinch, Tap} from 'mjolnir.js';
import type {PanRecognizerOptions, PinchRecognizerOptions, TapRecognizerOptions} from 'mjolnir.js';
/**
* The coordinate system that positions/dimensions are defined in.
*/
export type CoordinateSystem =
| 'default'
| 'lnglat'
| 'meter-offsets'
| 'lnglat-offsets'
| 'cartesian';
/**
* The coordinate system that positions/dimensions are defined in.
* String constants are the public API.
* @deprecated Use string constants directly.
*/
export const COORDINATE_SYSTEM = {
/**
* `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise
*/
DEFAULT: 'default',
/**
* Positions are interpreted as [longitude, latitude, elevation]
* longitude/latitude are in degrees, elevation is in meters.
* Dimensions are in meters.
*/
LNGLAT: 'lnglat',
/**
* Positions are interpreted as [x, y, z] in meter offsets from the coordinate origin.
* Dimensions are in meters.
*/
METER_OFFSETS: 'meter-offsets',
/**
* Positions are interpreted as [deltaLng, deltaLat, elevation] from the coordinate origin.
* deltaLng/deltaLat are in degrees, elevation is in meters.
* Dimensions are in meters.
*/
LNGLAT_OFFSETS: 'lnglat-offsets',
/**
* Positions and dimensions are in the common units of the viewport.
*/
CARTESIAN: 'cartesian'
} as const;
/**
* How coordinates are transformed from the world space into the common space.
*/
export const PROJECTION_MODE = {
/**
* Render geospatial data in Web Mercator projection
*/
WEB_MERCATOR: 1,
/**
* Render geospatial data as a 3D globe
*/
GLOBE: 2,
/**
* (Internal use only) Web Mercator projection at high zoom
*/
WEB_MERCATOR_AUTO_OFFSET: 4,
/**
* No transformation
*/
IDENTITY: 0
} as const;
export const UNIT = {
common: 0,
meters: 1,
pixels: 2
} as const;
export const EVENT_HANDLERS = {
click: 'onClick',
dblclick: 'onClick',
panstart: 'onDragStart',
panmove: 'onDrag',
panend: 'onDragEnd'
} as const satisfies {[eventName: string]: string};
// Order matters: recognizeWith/requireFailure resolve by name, so a recognizer
// must be registered before any later entry can reference it.
export const RECOGNIZERS = {
multipan: [Pan, {threshold: 10, pointers: 2, trackpad: true}],
pinch: [Pinch, {trackpad: true}, null, ['multipan']],
pan: [Pan, {threshold: 1}, ['pinch'], ['multipan']],
dblclick: [Tap, {event: 'dblclick', taps: 2, enable: false}],
dblclickdrag: [DoubleClickDrag, {event: 'dblclickdrag', enable: false}, ['dblclick'], null],
click: [Tap, {event: 'click'}, ['dblclickdrag'], ['dblclick', 'dblclickdrag']]
} as const;
export type RecognizerOptions = {
pinch?: Omit<PinchRecognizerOptions, 'event' | 'enable'>;
multipan?: Omit<PanRecognizerOptions, 'event' | 'enable'>;
pan?: Omit<PanRecognizerOptions, 'event' | 'enable'>;
dblclick?: Omit<TapRecognizerOptions, 'event' | 'enable'>;
click?: Omit<TapRecognizerOptions, 'event' | 'enable'>;
};
/**
* @deprecated Use string constants directly
*/
export const OPERATION = {
DRAW: 'draw',
MASK: 'mask',
TERRAIN: 'terrain'
} as const;