@antv/l7-map 2.25.6 → 2.25.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/es/index.d.ts +0 -5
- package/es/index.js +0 -4
- package/es/map/camera.d.ts +0 -690
- package/es/map/camera.js +0 -1138
- package/es/map/css/l7.css +0 -171
- package/es/map/events.d.ts +0 -384
- package/es/map/events.js +0 -231
- package/es/map/geo/edge_insets.d.ts +0 -97
- package/es/map/geo/edge_insets.js +0 -115
- package/es/map/geo/lng_lat.d.ts +0 -116
- package/es/map/geo/lng_lat.js +0 -159
- package/es/map/geo/lng_lat_bounds.d.ts +0 -217
- package/es/map/geo/lng_lat_bounds.js +0 -334
- package/es/map/geo/mercator_coordinate.d.ts +0 -113
- package/es/map/geo/mercator_coordinate.js +0 -142
- package/es/map/geo/transform.d.ts +0 -262
- package/es/map/geo/transform.js +0 -736
- package/es/map/handler/box_zoom.d.ts +0 -65
- package/es/map/handler/box_zoom.js +0 -145
- package/es/map/handler/click_zoom.d.ts +0 -24
- package/es/map/handler/click_zoom.js +0 -47
- package/es/map/handler/cooperative_gestures.d.ts +0 -40
- package/es/map/handler/cooperative_gestures.js +0 -94
- package/es/map/handler/drag_handler.d.ts +0 -88
- package/es/map/handler/drag_handler.js +0 -89
- package/es/map/handler/drag_move_state_manager.d.ts +0 -30
- package/es/map/handler/drag_move_state_manager.js +0 -94
- package/es/map/handler/handler_util.d.ts +0 -3
- package/es/map/handler/handler_util.js +0 -8
- package/es/map/handler/keyboard.d.ts +0 -88
- package/es/map/handler/keyboard.js +0 -197
- package/es/map/handler/map_event.d.ts +0 -46
- package/es/map/handler/map_event.js +0 -131
- package/es/map/handler/mouse.d.ts +0 -30
- package/es/map/handler/mouse.js +0 -85
- package/es/map/handler/one_finger_touch_drag.d.ts +0 -15
- package/es/map/handler/one_finger_touch_drag.js +0 -39
- package/es/map/handler/scroll_zoom.d.ts +0 -102
- package/es/map/handler/scroll_zoom.js +0 -312
- package/es/map/handler/shim/dblclick_zoom.d.ts +0 -44
- package/es/map/handler/shim/dblclick_zoom.js +0 -60
- package/es/map/handler/shim/drag_pan.d.ts +0 -79
- package/es/map/handler/shim/drag_pan.js +0 -77
- package/es/map/handler/shim/drag_rotate.d.ts +0 -54
- package/es/map/handler/shim/drag_rotate.js +0 -66
- package/es/map/handler/shim/two_fingers_touch.d.ts +0 -74
- package/es/map/handler/shim/two_fingers_touch.js +0 -106
- package/es/map/handler/tap_drag_zoom.d.ts +0 -28
- package/es/map/handler/tap_drag_zoom.js +0 -92
- package/es/map/handler/tap_recognizer.d.ts +0 -35
- package/es/map/handler/tap_recognizer.js +0 -107
- package/es/map/handler/tap_zoom.d.ts +0 -28
- package/es/map/handler/tap_zoom.js +0 -87
- package/es/map/handler/touch_pan.d.ts +0 -40
- package/es/map/handler/touch_pan.js +0 -85
- package/es/map/handler/transform-provider.d.ts +0 -23
- package/es/map/handler/transform-provider.js +0 -35
- package/es/map/handler/two_fingers_touch.d.ts +0 -107
- package/es/map/handler/two_fingers_touch.js +0 -289
- package/es/map/handler_inertia.d.ts +0 -20
- package/es/map/handler_inertia.js +0 -128
- package/es/map/handler_manager.d.ts +0 -154
- package/es/map/handler_manager.js +0 -466
- package/es/map/map.d.ts +0 -637
- package/es/map/map.js +0 -984
- package/es/map/util/abort_error.d.ts +0 -15
- package/es/map/util/abort_error.js +0 -21
- package/es/map/util/browser.d.ts +0 -10
- package/es/map/util/browser.js +0 -30
- package/es/map/util/dom.d.ts +0 -30
- package/es/map/util/dom.js +0 -105
- package/es/map/util/evented.d.ts +0 -75
- package/es/map/util/evented.js +0 -158
- package/es/map/util/simpleMapCoord.d.ts +0 -31
- package/es/map/util/simpleMapCoord.js +0 -54
- package/es/map/util/task_queue.d.ts +0 -18
- package/es/map/util/task_queue.js +0 -54
- package/es/map/util/util.d.ts +0 -104
- package/es/map/util/util.js +0 -155
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -33
- package/lib/map/camera.d.ts +0 -690
- package/lib/map/camera.js +0 -1145
- package/lib/map/css/l7.css +0 -171
- package/lib/map/events.d.ts +0 -384
- package/lib/map/events.js +0 -240
- package/lib/map/geo/edge_insets.d.ts +0 -97
- package/lib/map/geo/edge_insets.js +0 -122
- package/lib/map/geo/lng_lat.d.ts +0 -116
- package/lib/map/geo/lng_lat.js +0 -166
- package/lib/map/geo/lng_lat_bounds.d.ts +0 -217
- package/lib/map/geo/lng_lat_bounds.js +0 -341
- package/lib/map/geo/mercator_coordinate.d.ts +0 -113
- package/lib/map/geo/mercator_coordinate.js +0 -157
- package/lib/map/geo/transform.d.ts +0 -262
- package/lib/map/geo/transform.js +0 -744
- package/lib/map/handler/box_zoom.d.ts +0 -65
- package/lib/map/handler/box_zoom.js +0 -153
- package/lib/map/handler/click_zoom.d.ts +0 -24
- package/lib/map/handler/click_zoom.js +0 -54
- package/lib/map/handler/cooperative_gestures.d.ts +0 -40
- package/lib/map/handler/cooperative_gestures.js +0 -101
- package/lib/map/handler/drag_handler.d.ts +0 -88
- package/lib/map/handler/drag_handler.js +0 -97
- package/lib/map/handler/drag_move_state_manager.d.ts +0 -30
- package/lib/map/handler/drag_move_state_manager.js +0 -103
- package/lib/map/handler/handler_util.d.ts +0 -3
- package/lib/map/handler/handler_util.js +0 -14
- package/lib/map/handler/keyboard.d.ts +0 -88
- package/lib/map/handler/keyboard.js +0 -205
- package/lib/map/handler/map_event.d.ts +0 -46
- package/lib/map/handler/map_event.js +0 -140
- package/lib/map/handler/mouse.d.ts +0 -30
- package/lib/map/handler/mouse.js +0 -93
- package/lib/map/handler/one_finger_touch_drag.d.ts +0 -15
- package/lib/map/handler/one_finger_touch_drag.js +0 -47
- package/lib/map/handler/scroll_zoom.d.ts +0 -102
- package/lib/map/handler/scroll_zoom.js +0 -320
- package/lib/map/handler/shim/dblclick_zoom.d.ts +0 -44
- package/lib/map/handler/shim/dblclick_zoom.js +0 -68
- package/lib/map/handler/shim/drag_pan.d.ts +0 -79
- package/lib/map/handler/shim/drag_pan.js +0 -85
- package/lib/map/handler/shim/drag_rotate.d.ts +0 -54
- package/lib/map/handler/shim/drag_rotate.js +0 -74
- package/lib/map/handler/shim/two_fingers_touch.d.ts +0 -74
- package/lib/map/handler/shim/two_fingers_touch.js +0 -114
- package/lib/map/handler/tap_drag_zoom.d.ts +0 -28
- package/lib/map/handler/tap_drag_zoom.js +0 -99
- package/lib/map/handler/tap_recognizer.d.ts +0 -35
- package/lib/map/handler/tap_recognizer.js +0 -116
- package/lib/map/handler/tap_zoom.d.ts +0 -28
- package/lib/map/handler/tap_zoom.js +0 -94
- package/lib/map/handler/touch_pan.d.ts +0 -40
- package/lib/map/handler/touch_pan.js +0 -92
- package/lib/map/handler/transform-provider.d.ts +0 -23
- package/lib/map/handler/transform-provider.js +0 -43
- package/lib/map/handler/two_fingers_touch.d.ts +0 -107
- package/lib/map/handler/two_fingers_touch.js +0 -296
- package/lib/map/handler_inertia.d.ts +0 -20
- package/lib/map/handler_inertia.js +0 -136
- package/lib/map/handler_manager.d.ts +0 -154
- package/lib/map/handler_manager.js +0 -474
- package/lib/map/map.d.ts +0 -637
- package/lib/map/map.js +0 -991
- package/lib/map/util/abort_error.d.ts +0 -15
- package/lib/map/util/abort_error.js +0 -29
- package/lib/map/util/browser.d.ts +0 -10
- package/lib/map/util/browser.js +0 -36
- package/lib/map/util/dom.d.ts +0 -30
- package/lib/map/util/dom.js +0 -113
- package/lib/map/util/evented.d.ts +0 -75
- package/lib/map/util/evented.js +0 -167
- package/lib/map/util/simpleMapCoord.d.ts +0 -31
- package/lib/map/util/simpleMapCoord.js +0 -62
- package/lib/map/util/task_queue.d.ts +0 -18
- package/lib/map/util/task_queue.js +0 -62
- package/lib/map/util/util.d.ts +0 -104
- package/lib/map/util/util.js +0 -171
package/es/map/events.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { Event } from "./util/evented";
|
|
3
|
-
import Point from '@mapbox/point-geometry';
|
|
4
|
-
import { DOM } from "./util/dom";
|
|
5
|
-
import { SimpleMapCoord } from "./util/simpleMapCoord";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* `MapEventType` - a mapping between the event name and the event value.
|
|
9
|
-
* These events are used with the {@link Map#on} method.
|
|
10
|
-
* When using a `layerId` with {@link Map#on} method, please refer to {@link MapLayerEventType}.
|
|
11
|
-
* The following example can be used for all the events.
|
|
12
|
-
*
|
|
13
|
-
* @group Event Related
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* // Initialize the map
|
|
17
|
-
* let map = new Map({ // map options });
|
|
18
|
-
* // Set an event listener
|
|
19
|
-
* map.on('the-event-name', () => {
|
|
20
|
-
* console.log('An event has occurred!');
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The base event for MapLibre
|
|
27
|
-
*
|
|
28
|
-
* @group Event Related
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* `MapMouseEvent` is the event type for mouse-related map events.
|
|
33
|
-
*
|
|
34
|
-
* @group Event Related
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* // The `click` event is an example of a `MapMouseEvent`.
|
|
39
|
-
* // Set up an event listener on the map.
|
|
40
|
-
* map.on('click', (e) => {
|
|
41
|
-
* // The event object (e) contains information like the
|
|
42
|
-
* // coordinates of the point on the map that was clicked.
|
|
43
|
-
* console.log('A click event has occurred at ' + e.lngLat);
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export class MapMouseEvent extends Event {
|
|
48
|
-
/**
|
|
49
|
-
* Prevents subsequent default processing of the event by the map.
|
|
50
|
-
*
|
|
51
|
-
* Calling this method will prevent the following default map behaviors:
|
|
52
|
-
*
|
|
53
|
-
* * On `mousedown` events, the behavior of {@link DragPanHandler}
|
|
54
|
-
* * On `mousedown` events, the behavior of {@link DragRotateHandler}
|
|
55
|
-
* * On `mousedown` events, the behavior of {@link BoxZoomHandler}
|
|
56
|
-
* * On `dblclick` events, the behavior of {@link DoubleClickZoomHandler}
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
preventDefault() {
|
|
60
|
-
this._defaultPrevented = true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* `true` if `preventDefault` has been called.
|
|
65
|
-
*/
|
|
66
|
-
get defaultPrevented() {
|
|
67
|
-
return this._defaultPrevented;
|
|
68
|
-
}
|
|
69
|
-
constructor(type, map, originalEvent, data = {}) {
|
|
70
|
-
super(type, data);
|
|
71
|
-
/**
|
|
72
|
-
* The event type
|
|
73
|
-
*/
|
|
74
|
-
/**
|
|
75
|
-
* The `Map` object that fired the event.
|
|
76
|
-
*/
|
|
77
|
-
_defineProperty(this, "target", void 0);
|
|
78
|
-
/**
|
|
79
|
-
* The DOM event which caused the map event.
|
|
80
|
-
*/
|
|
81
|
-
_defineProperty(this, "originalEvent", void 0);
|
|
82
|
-
/**
|
|
83
|
-
* The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
|
|
84
|
-
*/
|
|
85
|
-
_defineProperty(this, "point", void 0);
|
|
86
|
-
/**
|
|
87
|
-
* The geographic location on the map of the mouse cursor.
|
|
88
|
-
*/
|
|
89
|
-
_defineProperty(this, "lngLat", void 0);
|
|
90
|
-
_defineProperty(this, "_defaultPrevented", void 0);
|
|
91
|
-
const point = DOM.mousePos(map.getCanvasContainer(), originalEvent);
|
|
92
|
-
const lngLat = map.unproject(point);
|
|
93
|
-
this.point = point;
|
|
94
|
-
this.lngLat = lngLat;
|
|
95
|
-
this.originalEvent = originalEvent;
|
|
96
|
-
this._defaultPrevented = false;
|
|
97
|
-
this.target = map;
|
|
98
|
-
if (map.version === 'SIMPLE') {
|
|
99
|
-
const simpleMapCoord = new SimpleMapCoord(map.mapSize);
|
|
100
|
-
const [lng, lat] = simpleMapCoord.project([lngLat.lng, lngLat.lat]);
|
|
101
|
-
this.lngLat = {
|
|
102
|
-
lng,
|
|
103
|
-
lat
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* `MapTouchEvent` is the event type for touch-related map events.
|
|
111
|
-
*
|
|
112
|
-
* @group Event Related
|
|
113
|
-
*/
|
|
114
|
-
export class MapTouchEvent extends Event {
|
|
115
|
-
/**
|
|
116
|
-
* Prevents subsequent default processing of the event by the map.
|
|
117
|
-
*
|
|
118
|
-
* Calling this method will prevent the following default map behaviors:
|
|
119
|
-
*
|
|
120
|
-
* * On `touchstart` events, the behavior of {@link DragPanHandler}
|
|
121
|
-
* * On `touchstart` events, the behavior of {@link TwoFingersTouchZoomRotateHandler}
|
|
122
|
-
*
|
|
123
|
-
*/
|
|
124
|
-
preventDefault() {
|
|
125
|
-
this._defaultPrevented = true;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* `true` if `preventDefault` has been called.
|
|
130
|
-
*/
|
|
131
|
-
get defaultPrevented() {
|
|
132
|
-
return this._defaultPrevented;
|
|
133
|
-
}
|
|
134
|
-
constructor(type, map, originalEvent) {
|
|
135
|
-
super(type);
|
|
136
|
-
/**
|
|
137
|
-
* The event type.
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* The `Map` object that fired the event.
|
|
141
|
-
*/
|
|
142
|
-
_defineProperty(this, "target", void 0);
|
|
143
|
-
/**
|
|
144
|
-
* The DOM event which caused the map event.
|
|
145
|
-
*/
|
|
146
|
-
_defineProperty(this, "originalEvent", void 0);
|
|
147
|
-
/**
|
|
148
|
-
* The geographic location on the map of the center of the touch event points.
|
|
149
|
-
*/
|
|
150
|
-
_defineProperty(this, "lngLat", void 0);
|
|
151
|
-
/**
|
|
152
|
-
* The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
|
|
153
|
-
* corner.
|
|
154
|
-
*/
|
|
155
|
-
_defineProperty(this, "point", void 0);
|
|
156
|
-
/**
|
|
157
|
-
* The array of pixel coordinates corresponding to a
|
|
158
|
-
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
159
|
-
*/
|
|
160
|
-
_defineProperty(this, "points", void 0);
|
|
161
|
-
/**
|
|
162
|
-
* The geographical locations on the map corresponding to a
|
|
163
|
-
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
164
|
-
*/
|
|
165
|
-
_defineProperty(this, "lngLats", void 0);
|
|
166
|
-
_defineProperty(this, "_defaultPrevented", void 0);
|
|
167
|
-
const touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;
|
|
168
|
-
const points = DOM.touchPos(map.getCanvasContainer(), touches);
|
|
169
|
-
const lngLats = points.map(t => map.unproject(t));
|
|
170
|
-
const point = points.reduce((prev, curr, i, arr) => {
|
|
171
|
-
return prev.add(curr.div(arr.length));
|
|
172
|
-
}, new Point(0, 0));
|
|
173
|
-
const lngLat = map.unproject(point);
|
|
174
|
-
this.target = map;
|
|
175
|
-
this.points = points;
|
|
176
|
-
this.point = point;
|
|
177
|
-
this.lngLats = lngLats;
|
|
178
|
-
this.lngLat = lngLat;
|
|
179
|
-
this.originalEvent = originalEvent;
|
|
180
|
-
this._defaultPrevented = false;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* `MapWheelEvent` is the event type for the `wheel` map event.
|
|
186
|
-
*
|
|
187
|
-
* @group Event Related
|
|
188
|
-
*
|
|
189
|
-
*/
|
|
190
|
-
export class MapWheelEvent extends Event {
|
|
191
|
-
/**
|
|
192
|
-
* Prevents subsequent default processing of the event by the map.
|
|
193
|
-
*
|
|
194
|
-
* Calling this method will prevent the behavior of {@link ScrollZoomHandler}.
|
|
195
|
-
*/
|
|
196
|
-
preventDefault() {
|
|
197
|
-
this._defaultPrevented = true;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* `true` if `preventDefault` has been called.
|
|
202
|
-
*/
|
|
203
|
-
get defaultPrevented() {
|
|
204
|
-
return this._defaultPrevented;
|
|
205
|
-
}
|
|
206
|
-
/** */
|
|
207
|
-
constructor(type, map, originalEvent) {
|
|
208
|
-
super(type);
|
|
209
|
-
/**
|
|
210
|
-
* The event type
|
|
211
|
-
*/
|
|
212
|
-
/**
|
|
213
|
-
* The `Map` object that fired the event.
|
|
214
|
-
*/
|
|
215
|
-
_defineProperty(this, "target", void 0);
|
|
216
|
-
/**
|
|
217
|
-
* The DOM event which caused the map event.
|
|
218
|
-
*/
|
|
219
|
-
_defineProperty(this, "originalEvent", void 0);
|
|
220
|
-
_defineProperty(this, "_defaultPrevented", void 0);
|
|
221
|
-
this.target = map;
|
|
222
|
-
this._defaultPrevented = false;
|
|
223
|
-
this.originalEvent = originalEvent;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* A `MapLibreZoomEvent` is the event type for the boxzoom-related map events emitted by the {@link BoxZoomHandler}.
|
|
229
|
-
*
|
|
230
|
-
* @group Event Related
|
|
231
|
-
*/
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/// <reference types="mapbox__point-geometry" />
|
|
2
|
-
import Point from '@mapbox/point-geometry';
|
|
3
|
-
/**
|
|
4
|
-
* An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
|
|
5
|
-
* This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
|
|
6
|
-
* on top of the map and having the vanishing point shift as UI elements resize.
|
|
7
|
-
*
|
|
8
|
-
* @group Geography and Geometry
|
|
9
|
-
*/
|
|
10
|
-
export declare class EdgeInsets {
|
|
11
|
-
/**
|
|
12
|
-
* @defaultValue 0
|
|
13
|
-
*/
|
|
14
|
-
top: number;
|
|
15
|
-
/**
|
|
16
|
-
* @defaultValue 0
|
|
17
|
-
*/
|
|
18
|
-
bottom: number;
|
|
19
|
-
/**
|
|
20
|
-
* @defaultValue 0
|
|
21
|
-
*/
|
|
22
|
-
left: number;
|
|
23
|
-
/**
|
|
24
|
-
* @defaultValue 0
|
|
25
|
-
*/
|
|
26
|
-
right: number;
|
|
27
|
-
constructor(top?: number, bottom?: number, left?: number, right?: number);
|
|
28
|
-
/**
|
|
29
|
-
* Interpolates the inset in-place.
|
|
30
|
-
* This maintains the current inset value for any inset not present in `target`.
|
|
31
|
-
* @param start - interpolation start
|
|
32
|
-
* @param target - interpolation target
|
|
33
|
-
* @param t - interpolation step/weight
|
|
34
|
-
* @returns the insets
|
|
35
|
-
*/
|
|
36
|
-
interpolate(start: PaddingOptions | EdgeInsets, target: PaddingOptions, t: number): EdgeInsets;
|
|
37
|
-
/**
|
|
38
|
-
* Utility method that computes the new apprent center or vanishing point after applying insets.
|
|
39
|
-
* This is in pixels and with the top left being (0.0) and +y being downwards.
|
|
40
|
-
*
|
|
41
|
-
* @param width - the width
|
|
42
|
-
* @param height - the height
|
|
43
|
-
* @returns the point
|
|
44
|
-
*/
|
|
45
|
-
getCenter(width: number, height: number): Point;
|
|
46
|
-
equals(other: PaddingOptions): boolean;
|
|
47
|
-
clone(): EdgeInsets;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the current state as json, useful when you want to have a
|
|
50
|
-
* read-only representation of the inset.
|
|
51
|
-
*
|
|
52
|
-
* @returns state as json
|
|
53
|
-
*/
|
|
54
|
-
toJSON(): PaddingOptions;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Options for setting padding on calls to methods such as {@link Map#fitBounds}, {@link Map#fitScreenCoordinates}, and {@link Map#setPadding}. Adjust these options to set the amount of padding in pixels added to the edges of the canvas. Set a uniform padding on all edges or individual values for each edge. All properties of this object must be
|
|
58
|
-
* non-negative integers.
|
|
59
|
-
*
|
|
60
|
-
* @group Geography and Geometry
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```ts
|
|
64
|
-
* let bbox = [[-79, 43], [-73, 45]];
|
|
65
|
-
* map.fitBounds(bbox, {
|
|
66
|
-
* padding: {top: 10, bottom:25, left: 15, right: 5}
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```ts
|
|
72
|
-
* let bbox = [[-79, 43], [-73, 45]];
|
|
73
|
-
* map.fitBounds(bbox, {
|
|
74
|
-
* padding: 20
|
|
75
|
-
* });
|
|
76
|
-
* ```
|
|
77
|
-
* @see [Fit to the bounds of a LineString](https://maplibre.org/maplibre-gl-js/docs/examples/zoomto-linestring/)
|
|
78
|
-
* @see [Fit a map to a bounding box](https://maplibre.org/maplibre-gl-js/docs/examples/fitbounds/)
|
|
79
|
-
*/
|
|
80
|
-
export type PaddingOptions = {
|
|
81
|
-
/**
|
|
82
|
-
* Padding in pixels from the top of the map canvas.
|
|
83
|
-
*/
|
|
84
|
-
top: number;
|
|
85
|
-
/**
|
|
86
|
-
* Padding in pixels from the bottom of the map canvas.
|
|
87
|
-
*/
|
|
88
|
-
bottom: number;
|
|
89
|
-
/**
|
|
90
|
-
* Padding in pixels from the left of the map canvas.
|
|
91
|
-
*/
|
|
92
|
-
right: number;
|
|
93
|
-
/**
|
|
94
|
-
* Padding in pixels from the right of the map canvas.
|
|
95
|
-
*/
|
|
96
|
-
left: number;
|
|
97
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import Point from '@mapbox/point-geometry';
|
|
3
|
-
import { clamp, interpolates } from "../util/util";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
|
|
7
|
-
* This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
|
|
8
|
-
* on top of the map and having the vanishing point shift as UI elements resize.
|
|
9
|
-
*
|
|
10
|
-
* @group Geography and Geometry
|
|
11
|
-
*/
|
|
12
|
-
export class EdgeInsets {
|
|
13
|
-
constructor(top = 0, bottom = 0, left = 0, right = 0) {
|
|
14
|
-
/**
|
|
15
|
-
* @defaultValue 0
|
|
16
|
-
*/
|
|
17
|
-
_defineProperty(this, "top", void 0);
|
|
18
|
-
/**
|
|
19
|
-
* @defaultValue 0
|
|
20
|
-
*/
|
|
21
|
-
_defineProperty(this, "bottom", void 0);
|
|
22
|
-
/**
|
|
23
|
-
* @defaultValue 0
|
|
24
|
-
*/
|
|
25
|
-
_defineProperty(this, "left", void 0);
|
|
26
|
-
/**
|
|
27
|
-
* @defaultValue 0
|
|
28
|
-
*/
|
|
29
|
-
_defineProperty(this, "right", void 0);
|
|
30
|
-
if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
|
|
31
|
-
throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
|
|
32
|
-
}
|
|
33
|
-
this.top = top;
|
|
34
|
-
this.bottom = bottom;
|
|
35
|
-
this.left = left;
|
|
36
|
-
this.right = right;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Interpolates the inset in-place.
|
|
41
|
-
* This maintains the current inset value for any inset not present in `target`.
|
|
42
|
-
* @param start - interpolation start
|
|
43
|
-
* @param target - interpolation target
|
|
44
|
-
* @param t - interpolation step/weight
|
|
45
|
-
* @returns the insets
|
|
46
|
-
*/
|
|
47
|
-
interpolate(start, target, t) {
|
|
48
|
-
if (target.top != null && start.top != null) this.top = interpolates.number(start.top, target.top, t);
|
|
49
|
-
if (target.bottom != null && start.bottom != null) this.bottom = interpolates.number(start.bottom, target.bottom, t);
|
|
50
|
-
if (target.left != null && start.left != null) this.left = interpolates.number(start.left, target.left, t);
|
|
51
|
-
if (target.right != null && start.right != null) this.right = interpolates.number(start.right, target.right, t);
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Utility method that computes the new apprent center or vanishing point after applying insets.
|
|
57
|
-
* This is in pixels and with the top left being (0.0) and +y being downwards.
|
|
58
|
-
*
|
|
59
|
-
* @param width - the width
|
|
60
|
-
* @param height - the height
|
|
61
|
-
* @returns the point
|
|
62
|
-
*/
|
|
63
|
-
getCenter(width, height) {
|
|
64
|
-
// Clamp insets so they never overflow width/height and always calculate a valid center
|
|
65
|
-
const x = clamp((this.left + width - this.right) / 2, 0, width);
|
|
66
|
-
const y = clamp((this.top + height - this.bottom) / 2, 0, height);
|
|
67
|
-
return new Point(x, y);
|
|
68
|
-
}
|
|
69
|
-
equals(other) {
|
|
70
|
-
return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
|
|
71
|
-
}
|
|
72
|
-
clone() {
|
|
73
|
-
return new EdgeInsets(this.top, this.bottom, this.left, this.right);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Returns the current state as json, useful when you want to have a
|
|
78
|
-
* read-only representation of the inset.
|
|
79
|
-
*
|
|
80
|
-
* @returns state as json
|
|
81
|
-
*/
|
|
82
|
-
toJSON() {
|
|
83
|
-
return {
|
|
84
|
-
top: this.top,
|
|
85
|
-
bottom: this.bottom,
|
|
86
|
-
left: this.left,
|
|
87
|
-
right: this.right
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Options for setting padding on calls to methods such as {@link Map#fitBounds}, {@link Map#fitScreenCoordinates}, and {@link Map#setPadding}. Adjust these options to set the amount of padding in pixels added to the edges of the canvas. Set a uniform padding on all edges or individual values for each edge. All properties of this object must be
|
|
94
|
-
* non-negative integers.
|
|
95
|
-
*
|
|
96
|
-
* @group Geography and Geometry
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts
|
|
100
|
-
* let bbox = [[-79, 43], [-73, 45]];
|
|
101
|
-
* map.fitBounds(bbox, {
|
|
102
|
-
* padding: {top: 10, bottom:25, left: 15, right: 5}
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts
|
|
108
|
-
* let bbox = [[-79, 43], [-73, 45]];
|
|
109
|
-
* map.fitBounds(bbox, {
|
|
110
|
-
* padding: 20
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
* @see [Fit to the bounds of a LineString](https://maplibre.org/maplibre-gl-js/docs/examples/zoomto-linestring/)
|
|
114
|
-
* @see [Fit a map to a bounding box](https://maplibre.org/maplibre-gl-js/docs/examples/fitbounds/)
|
|
115
|
-
*/
|
package/es/map/geo/lng_lat.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
export declare const earthRadius = 6371008.8;
|
|
2
|
-
/**
|
|
3
|
-
* A {@link LngLat} object, an array of two numbers representing longitude and latitude,
|
|
4
|
-
* or an object with `lng` and `lat` or `lon` and `lat` properties.
|
|
5
|
-
*
|
|
6
|
-
* @group Geography and Geometry
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* let v1 = new LngLat(-122.420679, 37.772537);
|
|
11
|
-
* let v2 = [-122.420679, 37.772537];
|
|
12
|
-
* let v3 = {lon: -122.420679, lat: 37.772537};
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export type LngLatLike = LngLat | {
|
|
16
|
-
lng: number;
|
|
17
|
-
lat: number;
|
|
18
|
-
} | {
|
|
19
|
-
lon: number;
|
|
20
|
-
lat: number;
|
|
21
|
-
} | [number, number];
|
|
22
|
-
/**
|
|
23
|
-
* A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.
|
|
24
|
-
* These coordinates are based on the [WGS84 (EPSG:4326) standard](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).
|
|
25
|
-
*
|
|
26
|
-
* MapLibre GL JS uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match the
|
|
27
|
-
* [GeoJSON specification](https://tools.ietf.org/html/rfc7946).
|
|
28
|
-
*
|
|
29
|
-
* Note that any MapLibre GL JS method that accepts a `LngLat` object as an argument or option
|
|
30
|
-
* can also accept an `Array` of two numbers and will perform an implicit conversion.
|
|
31
|
-
* This flexible type is documented as {@link LngLatLike}.
|
|
32
|
-
*
|
|
33
|
-
* @group Geography and Geometry
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* let ll = new LngLat(-123.9749, 40.7736);
|
|
38
|
-
* ll.lng; // = -123.9749
|
|
39
|
-
* ```
|
|
40
|
-
* @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/mouse-position/)
|
|
41
|
-
* @see [Display a popup](https://maplibre.org/maplibre-gl-js/docs/examples/popup/)
|
|
42
|
-
* @see [Create a timeline animation](https://maplibre.org/maplibre-gl-js/docs/examples/timeline-animation/)
|
|
43
|
-
*/
|
|
44
|
-
export declare class LngLat {
|
|
45
|
-
lng: number;
|
|
46
|
-
lat: number;
|
|
47
|
-
/**
|
|
48
|
-
* @param lng - Longitude, measured in degrees.
|
|
49
|
-
* @param lat - Latitude, measured in degrees.
|
|
50
|
-
*/
|
|
51
|
-
constructor(lng: number, lat: number);
|
|
52
|
-
/**
|
|
53
|
-
* Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180).
|
|
54
|
-
*
|
|
55
|
-
* @returns The wrapped `LngLat` object.
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* let ll = new LngLat(286.0251, 40.7736);
|
|
59
|
-
* let wrapped = ll.wrap();
|
|
60
|
-
* wrapped.lng; // = -73.9749
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
wrap(): LngLat;
|
|
64
|
-
/**
|
|
65
|
-
* Returns the coordinates represented as an array of two numbers.
|
|
66
|
-
*
|
|
67
|
-
* @returns The coordinates represented as an array of longitude and latitude.
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* let ll = new LngLat(-73.9749, 40.7736);
|
|
71
|
-
* ll.toArray(); // = [-73.9749, 40.7736]
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
toArray(): [number, number];
|
|
75
|
-
/**
|
|
76
|
-
* Returns the coordinates represent as a string.
|
|
77
|
-
*
|
|
78
|
-
* @returns The coordinates represented as a string of the format `'LngLat(lng, lat)'`.
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* let ll = new LngLat(-73.9749, 40.7736);
|
|
82
|
-
* ll.toString(); // = "LngLat(-73.9749, 40.7736)"
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
toString(): string;
|
|
86
|
-
/**
|
|
87
|
-
* Returns the approximate distance between a pair of coordinates in meters
|
|
88
|
-
* Uses the Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)
|
|
89
|
-
*
|
|
90
|
-
* @param lngLat - coordinates to compute the distance to
|
|
91
|
-
* @returns Distance in meters between the two coordinates.
|
|
92
|
-
* @example
|
|
93
|
-
* ```ts
|
|
94
|
-
* let new_york = new LngLat(-74.0060, 40.7128);
|
|
95
|
-
* let los_angeles = new LngLat(-118.2437, 34.0522);
|
|
96
|
-
* new_york.distanceTo(los_angeles); // = 3935751.690893987, "true distance" using a non-spherical approximation is ~3966km
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
distanceTo(lngLat: LngLat): number;
|
|
100
|
-
/**
|
|
101
|
-
* Converts an array of two numbers or an object with `lng` and `lat` or `lon` and `lat` properties
|
|
102
|
-
* to a `LngLat` object.
|
|
103
|
-
*
|
|
104
|
-
* If a `LngLat` object is passed in, the function returns it unchanged.
|
|
105
|
-
*
|
|
106
|
-
* @param input - An array of two numbers or object to convert, or a `LngLat` object to return.
|
|
107
|
-
* @returns A new `LngLat` object, if a conversion occurred, or the original `LngLat` object.
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* let arr = [-73.9749, 40.7736];
|
|
111
|
-
* let ll = LngLat.convert(arr);
|
|
112
|
-
* ll; // = LngLat {lng: -73.9749, lat: 40.7736}
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
static convert(input: LngLatLike): LngLat;
|
|
116
|
-
}
|