@antv/l7-map 2.25.5 → 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.
Files changed (159) hide show
  1. package/package.json +2 -2
  2. package/es/index.d.ts +0 -5
  3. package/es/index.js +0 -4
  4. package/es/map/camera.d.ts +0 -690
  5. package/es/map/camera.js +0 -1138
  6. package/es/map/css/l7.css +0 -171
  7. package/es/map/events.d.ts +0 -384
  8. package/es/map/events.js +0 -231
  9. package/es/map/geo/edge_insets.d.ts +0 -97
  10. package/es/map/geo/edge_insets.js +0 -115
  11. package/es/map/geo/lng_lat.d.ts +0 -116
  12. package/es/map/geo/lng_lat.js +0 -159
  13. package/es/map/geo/lng_lat_bounds.d.ts +0 -217
  14. package/es/map/geo/lng_lat_bounds.js +0 -334
  15. package/es/map/geo/mercator_coordinate.d.ts +0 -113
  16. package/es/map/geo/mercator_coordinate.js +0 -142
  17. package/es/map/geo/transform.d.ts +0 -262
  18. package/es/map/geo/transform.js +0 -736
  19. package/es/map/handler/box_zoom.d.ts +0 -65
  20. package/es/map/handler/box_zoom.js +0 -145
  21. package/es/map/handler/click_zoom.d.ts +0 -24
  22. package/es/map/handler/click_zoom.js +0 -47
  23. package/es/map/handler/cooperative_gestures.d.ts +0 -40
  24. package/es/map/handler/cooperative_gestures.js +0 -94
  25. package/es/map/handler/drag_handler.d.ts +0 -88
  26. package/es/map/handler/drag_handler.js +0 -89
  27. package/es/map/handler/drag_move_state_manager.d.ts +0 -30
  28. package/es/map/handler/drag_move_state_manager.js +0 -94
  29. package/es/map/handler/handler_util.d.ts +0 -3
  30. package/es/map/handler/handler_util.js +0 -8
  31. package/es/map/handler/keyboard.d.ts +0 -88
  32. package/es/map/handler/keyboard.js +0 -197
  33. package/es/map/handler/map_event.d.ts +0 -46
  34. package/es/map/handler/map_event.js +0 -131
  35. package/es/map/handler/mouse.d.ts +0 -30
  36. package/es/map/handler/mouse.js +0 -85
  37. package/es/map/handler/one_finger_touch_drag.d.ts +0 -15
  38. package/es/map/handler/one_finger_touch_drag.js +0 -39
  39. package/es/map/handler/scroll_zoom.d.ts +0 -102
  40. package/es/map/handler/scroll_zoom.js +0 -312
  41. package/es/map/handler/shim/dblclick_zoom.d.ts +0 -44
  42. package/es/map/handler/shim/dblclick_zoom.js +0 -60
  43. package/es/map/handler/shim/drag_pan.d.ts +0 -79
  44. package/es/map/handler/shim/drag_pan.js +0 -77
  45. package/es/map/handler/shim/drag_rotate.d.ts +0 -54
  46. package/es/map/handler/shim/drag_rotate.js +0 -66
  47. package/es/map/handler/shim/two_fingers_touch.d.ts +0 -74
  48. package/es/map/handler/shim/two_fingers_touch.js +0 -106
  49. package/es/map/handler/tap_drag_zoom.d.ts +0 -28
  50. package/es/map/handler/tap_drag_zoom.js +0 -92
  51. package/es/map/handler/tap_recognizer.d.ts +0 -35
  52. package/es/map/handler/tap_recognizer.js +0 -107
  53. package/es/map/handler/tap_zoom.d.ts +0 -28
  54. package/es/map/handler/tap_zoom.js +0 -87
  55. package/es/map/handler/touch_pan.d.ts +0 -40
  56. package/es/map/handler/touch_pan.js +0 -85
  57. package/es/map/handler/transform-provider.d.ts +0 -23
  58. package/es/map/handler/transform-provider.js +0 -35
  59. package/es/map/handler/two_fingers_touch.d.ts +0 -107
  60. package/es/map/handler/two_fingers_touch.js +0 -289
  61. package/es/map/handler_inertia.d.ts +0 -20
  62. package/es/map/handler_inertia.js +0 -128
  63. package/es/map/handler_manager.d.ts +0 -154
  64. package/es/map/handler_manager.js +0 -466
  65. package/es/map/map.d.ts +0 -637
  66. package/es/map/map.js +0 -984
  67. package/es/map/util/abort_error.d.ts +0 -15
  68. package/es/map/util/abort_error.js +0 -21
  69. package/es/map/util/browser.d.ts +0 -10
  70. package/es/map/util/browser.js +0 -30
  71. package/es/map/util/dom.d.ts +0 -30
  72. package/es/map/util/dom.js +0 -105
  73. package/es/map/util/evented.d.ts +0 -75
  74. package/es/map/util/evented.js +0 -158
  75. package/es/map/util/simpleMapCoord.d.ts +0 -31
  76. package/es/map/util/simpleMapCoord.js +0 -54
  77. package/es/map/util/task_queue.d.ts +0 -18
  78. package/es/map/util/task_queue.js +0 -54
  79. package/es/map/util/util.d.ts +0 -104
  80. package/es/map/util/util.js +0 -155
  81. package/lib/index.d.ts +0 -5
  82. package/lib/index.js +0 -33
  83. package/lib/map/camera.d.ts +0 -690
  84. package/lib/map/camera.js +0 -1145
  85. package/lib/map/css/l7.css +0 -171
  86. package/lib/map/events.d.ts +0 -384
  87. package/lib/map/events.js +0 -240
  88. package/lib/map/geo/edge_insets.d.ts +0 -97
  89. package/lib/map/geo/edge_insets.js +0 -122
  90. package/lib/map/geo/lng_lat.d.ts +0 -116
  91. package/lib/map/geo/lng_lat.js +0 -166
  92. package/lib/map/geo/lng_lat_bounds.d.ts +0 -217
  93. package/lib/map/geo/lng_lat_bounds.js +0 -341
  94. package/lib/map/geo/mercator_coordinate.d.ts +0 -113
  95. package/lib/map/geo/mercator_coordinate.js +0 -157
  96. package/lib/map/geo/transform.d.ts +0 -262
  97. package/lib/map/geo/transform.js +0 -744
  98. package/lib/map/handler/box_zoom.d.ts +0 -65
  99. package/lib/map/handler/box_zoom.js +0 -153
  100. package/lib/map/handler/click_zoom.d.ts +0 -24
  101. package/lib/map/handler/click_zoom.js +0 -54
  102. package/lib/map/handler/cooperative_gestures.d.ts +0 -40
  103. package/lib/map/handler/cooperative_gestures.js +0 -101
  104. package/lib/map/handler/drag_handler.d.ts +0 -88
  105. package/lib/map/handler/drag_handler.js +0 -97
  106. package/lib/map/handler/drag_move_state_manager.d.ts +0 -30
  107. package/lib/map/handler/drag_move_state_manager.js +0 -103
  108. package/lib/map/handler/handler_util.d.ts +0 -3
  109. package/lib/map/handler/handler_util.js +0 -14
  110. package/lib/map/handler/keyboard.d.ts +0 -88
  111. package/lib/map/handler/keyboard.js +0 -205
  112. package/lib/map/handler/map_event.d.ts +0 -46
  113. package/lib/map/handler/map_event.js +0 -140
  114. package/lib/map/handler/mouse.d.ts +0 -30
  115. package/lib/map/handler/mouse.js +0 -93
  116. package/lib/map/handler/one_finger_touch_drag.d.ts +0 -15
  117. package/lib/map/handler/one_finger_touch_drag.js +0 -47
  118. package/lib/map/handler/scroll_zoom.d.ts +0 -102
  119. package/lib/map/handler/scroll_zoom.js +0 -320
  120. package/lib/map/handler/shim/dblclick_zoom.d.ts +0 -44
  121. package/lib/map/handler/shim/dblclick_zoom.js +0 -68
  122. package/lib/map/handler/shim/drag_pan.d.ts +0 -79
  123. package/lib/map/handler/shim/drag_pan.js +0 -85
  124. package/lib/map/handler/shim/drag_rotate.d.ts +0 -54
  125. package/lib/map/handler/shim/drag_rotate.js +0 -74
  126. package/lib/map/handler/shim/two_fingers_touch.d.ts +0 -74
  127. package/lib/map/handler/shim/two_fingers_touch.js +0 -114
  128. package/lib/map/handler/tap_drag_zoom.d.ts +0 -28
  129. package/lib/map/handler/tap_drag_zoom.js +0 -99
  130. package/lib/map/handler/tap_recognizer.d.ts +0 -35
  131. package/lib/map/handler/tap_recognizer.js +0 -116
  132. package/lib/map/handler/tap_zoom.d.ts +0 -28
  133. package/lib/map/handler/tap_zoom.js +0 -94
  134. package/lib/map/handler/touch_pan.d.ts +0 -40
  135. package/lib/map/handler/touch_pan.js +0 -92
  136. package/lib/map/handler/transform-provider.d.ts +0 -23
  137. package/lib/map/handler/transform-provider.js +0 -43
  138. package/lib/map/handler/two_fingers_touch.d.ts +0 -107
  139. package/lib/map/handler/two_fingers_touch.js +0 -296
  140. package/lib/map/handler_inertia.d.ts +0 -20
  141. package/lib/map/handler_inertia.js +0 -136
  142. package/lib/map/handler_manager.d.ts +0 -154
  143. package/lib/map/handler_manager.js +0 -474
  144. package/lib/map/map.d.ts +0 -637
  145. package/lib/map/map.js +0 -991
  146. package/lib/map/util/abort_error.d.ts +0 -15
  147. package/lib/map/util/abort_error.js +0 -29
  148. package/lib/map/util/browser.d.ts +0 -10
  149. package/lib/map/util/browser.js +0 -36
  150. package/lib/map/util/dom.d.ts +0 -30
  151. package/lib/map/util/dom.js +0 -113
  152. package/lib/map/util/evented.d.ts +0 -75
  153. package/lib/map/util/evented.js +0 -167
  154. package/lib/map/util/simpleMapCoord.d.ts +0 -31
  155. package/lib/map/util/simpleMapCoord.js +0 -62
  156. package/lib/map/util/task_queue.d.ts +0 -18
  157. package/lib/map/util/task_queue.js +0 -62
  158. package/lib/map/util/util.d.ts +0 -104
  159. package/lib/map/util/util.js +0 -171
@@ -1,128 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import Point from '@mapbox/point-geometry';
3
- import { browser } from "./util/browser";
4
- import { bezier, clamp, extend } from "./util/util";
5
- const defaultInertiaOptions = {
6
- linearity: 0.3,
7
- easing: bezier(0, 0, 0.3, 1)
8
- };
9
- const defaultPanInertiaOptions = extend({
10
- deceleration: 2500,
11
- maxSpeed: 1400
12
- }, defaultInertiaOptions);
13
- const defaultZoomInertiaOptions = extend({
14
- deceleration: 20,
15
- maxSpeed: 1400
16
- }, defaultInertiaOptions);
17
- const defaultBearingInertiaOptions = extend({
18
- deceleration: 1000,
19
- maxSpeed: 360
20
- }, defaultInertiaOptions);
21
- const defaultPitchInertiaOptions = extend({
22
- deceleration: 1000,
23
- maxSpeed: 90
24
- }, defaultInertiaOptions);
25
- export class HandlerInertia {
26
- constructor(map) {
27
- _defineProperty(this, "_map", void 0);
28
- _defineProperty(this, "_inertiaBuffer", void 0);
29
- this._map = map;
30
- this.clear();
31
- }
32
- clear() {
33
- this._inertiaBuffer = [];
34
- }
35
- record(settings) {
36
- this._drainInertiaBuffer();
37
- this._inertiaBuffer.push({
38
- time: browser.now(),
39
- settings
40
- });
41
- }
42
- _drainInertiaBuffer() {
43
- const inertia = this._inertiaBuffer,
44
- now = browser.now(),
45
- cutoff = 160; //msec
46
-
47
- while (inertia.length > 0 && now - inertia[0].time > cutoff) inertia.shift();
48
- }
49
- _onMoveEnd(panInertiaOptions) {
50
- this._drainInertiaBuffer();
51
- if (this._inertiaBuffer.length < 2) {
52
- return;
53
- }
54
- const deltas = {
55
- zoom: 0,
56
- bearing: 0,
57
- pitch: 0,
58
- pan: new Point(0, 0),
59
- pinchAround: undefined,
60
- around: undefined
61
- };
62
- for (const {
63
- settings
64
- } of this._inertiaBuffer) {
65
- deltas.zoom += settings.zoomDelta || 0;
66
- deltas.bearing += settings.bearingDelta || 0;
67
- deltas.pitch += settings.pitchDelta || 0;
68
- if (settings.panDelta) deltas.pan._add(settings.panDelta);
69
- if (settings.around) deltas.around = settings.around;
70
- if (settings.pinchAround) deltas.pinchAround = settings.pinchAround;
71
- }
72
- const lastEntry = this._inertiaBuffer[this._inertiaBuffer.length - 1];
73
- const duration = lastEntry.time - this._inertiaBuffer[0].time;
74
- const easeOptions = {};
75
- if (deltas.pan.mag()) {
76
- const result = calculateEasing(deltas.pan.mag(), duration, extend({}, defaultPanInertiaOptions, panInertiaOptions || {}));
77
- easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());
78
- easeOptions.center = this._map.transform.center;
79
- extendDuration(easeOptions, result);
80
- }
81
- if (deltas.zoom) {
82
- const result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);
83
- easeOptions.zoom = this._map.transform.zoom + result.amount;
84
- extendDuration(easeOptions, result);
85
- }
86
- if (deltas.bearing) {
87
- const result = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);
88
- easeOptions.bearing = this._map.transform.bearing + clamp(result.amount, -179, 179);
89
- extendDuration(easeOptions, result);
90
- }
91
- if (deltas.pitch) {
92
- const result = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);
93
- easeOptions.pitch = this._map.transform.pitch + result.amount;
94
- extendDuration(easeOptions, result);
95
- }
96
- if (easeOptions.zoom || easeOptions.bearing) {
97
- const last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;
98
- easeOptions.around = last ? this._map.unproject(last) : this._map.getCenter();
99
- }
100
- this.clear();
101
- return extend(easeOptions, {
102
- noMoveStart: true
103
- });
104
- }
105
- }
106
-
107
- // Unfortunately zoom, bearing, etc can't have different durations and easings so
108
- // we need to choose one. We use the longest duration and it's corresponding easing.
109
- function extendDuration(easeOptions, result) {
110
- if (!easeOptions.duration || easeOptions.duration < result.duration) {
111
- easeOptions.duration = result.duration;
112
- easeOptions.easing = result.easing;
113
- }
114
- }
115
- function calculateEasing(amount, inertiaDuration, inertiaOptions) {
116
- const {
117
- maxSpeed,
118
- linearity,
119
- deceleration
120
- } = inertiaOptions;
121
- const speed = clamp(amount * linearity / (inertiaDuration / 1000), -maxSpeed, maxSpeed);
122
- const duration = Math.abs(speed) / (deceleration * linearity);
123
- return {
124
- easing: inertiaOptions.easing,
125
- duration: duration * 1000,
126
- amount: speed * (duration / 2)
127
- };
128
- }
@@ -1,154 +0,0 @@
1
- /// <reference types="mapbox__point-geometry" />
2
- import Point from '@mapbox/point-geometry';
3
- import { HandlerInertia } from './handler_inertia';
4
- import type { CompleteMapOptions, Map } from './map';
5
- import { Event } from './util/evented';
6
- /**
7
- * Handlers interpret dom events and return camera changes that should be
8
- * applied to the map (`HandlerResult`s). The camera changes are all deltas.
9
- * The handler itself should have no knowledge of the map's current state.
10
- * This makes it easier to merge multiple results and keeps handlers simpler.
11
- * For example, if there is a mousedown and mousemove, the mousePan handler
12
- * would return a `panDelta` on the mousemove.
13
- */
14
- export interface Handler {
15
- enable(): void;
16
- disable(): void;
17
- isEnabled(): boolean;
18
- /**
19
- * This is used to indicate if the handler is currently active or not.
20
- * In case a handler is active, it will block other handlers from getting the relevant events.
21
- * There is an allow list of handlers that can be active at the same time, which is configured when adding a handler.
22
- */
23
- isActive(): boolean;
24
- /**
25
- * `reset` can be called by the manager at any time and must reset everything to it's original state
26
- */
27
- reset(): void;
28
- readonly touchstart?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
29
- readonly touchmove?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
30
- readonly touchmoveWindow?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
31
- readonly touchend?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
32
- readonly touchcancel?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
33
- readonly mousedown?: (e: MouseEvent, point: Point) => HandlerResult | void;
34
- readonly mousemove?: (e: MouseEvent, point: Point) => HandlerResult | void;
35
- readonly mousemoveWindow?: (e: MouseEvent, point: Point) => HandlerResult | void;
36
- readonly mouseup?: (e: MouseEvent, point: Point) => HandlerResult | void;
37
- readonly mouseupWindow?: (e: MouseEvent, point: Point) => HandlerResult | void;
38
- readonly dblclick?: (e: MouseEvent, point: Point) => HandlerResult | void;
39
- readonly contextmenu?: (e: MouseEvent) => HandlerResult | void;
40
- readonly wheel?: (e: WheelEvent, point: Point) => HandlerResult | void;
41
- readonly keydown?: (e: KeyboardEvent) => HandlerResult | void;
42
- readonly keyup?: (e: KeyboardEvent) => HandlerResult | void;
43
- /**
44
- * `renderFrame` is the only non-dom event. It is called during render
45
- * frames and can be used to smooth camera changes (see scroll handler).
46
- */
47
- readonly renderFrame?: () => HandlerResult | void;
48
- }
49
- /**
50
- * All handler methods that are called with events can optionally return a `HandlerResult`.
51
- */
52
- export type HandlerResult = {
53
- panDelta?: Point;
54
- zoomDelta?: number;
55
- bearingDelta?: number;
56
- pitchDelta?: number;
57
- /**
58
- * the point to not move when changing the camera
59
- */
60
- around?: Point | null;
61
- /**
62
- * same as above, except for pinch actions, which are given higher priority
63
- */
64
- pinchAround?: Point | null;
65
- /**
66
- * A method that can fire a one-off easing by directly changing the map's camera.
67
- */
68
- cameraAnimation?: (map: Map) => any;
69
- /**
70
- * The last three properties are needed by only one handler: scrollzoom.
71
- * The DOM event to be used as the `originalEvent` on any camera change events.
72
- */
73
- originalEvent?: Event;
74
- /**
75
- * Makes the manager trigger a frame, allowing the handler to return multiple results over time (see scrollzoom).
76
- */
77
- needsRenderFrame?: boolean;
78
- /**
79
- * The camera changes won't get recorded for inertial zooming.
80
- */
81
- noInertia?: boolean;
82
- };
83
- export type EventInProgress = {
84
- handlerName: string;
85
- originalEvent: Event;
86
- };
87
- export type EventsInProgress = {
88
- zoom?: EventInProgress;
89
- pitch?: EventInProgress;
90
- rotate?: EventInProgress;
91
- drag?: EventInProgress;
92
- };
93
- export declare class HandlerManager {
94
- _map: Map;
95
- _el: HTMLElement;
96
- _handlers: Array<{
97
- handlerName: string;
98
- handler: Handler;
99
- allowed: Array<string>;
100
- }>;
101
- _eventsInProgress: EventsInProgress;
102
- _frameId: number;
103
- _inertia: HandlerInertia;
104
- _bearingSnap: number;
105
- _handlersById: {
106
- [x: string]: Handler;
107
- };
108
- _updatingCamera: boolean;
109
- _changes: Array<[HandlerResult, EventsInProgress, {
110
- [handlerName: string]: Event;
111
- }]>;
112
- _zoom: {
113
- handlerName: string;
114
- };
115
- _previousActiveHandlers: {
116
- [x: string]: Handler;
117
- };
118
- _listeners: Array<[
119
- Window | Document | HTMLElement,
120
- string,
121
- ({
122
- passive?: boolean;
123
- capture?: boolean;
124
- } | undefined)
125
- ]>;
126
- constructor(map: Map, options: CompleteMapOptions);
127
- destroy(): void;
128
- _addDefaultHandlers(options: CompleteMapOptions): void;
129
- _add(handlerName: string, handler: Handler, allowed?: Array<string>): void;
130
- stop(allowEndAnimation: boolean): void;
131
- isActive(): boolean;
132
- isZooming(): boolean;
133
- isRotating(): boolean;
134
- isMoving(): boolean;
135
- _blockedByActive(activeHandlers: {
136
- [x: string]: Handler;
137
- }, allowed: Array<string>, myName: string): boolean;
138
- handleWindowEvent: (e: {
139
- type: 'mousemove' | 'mouseup' | 'touchmove';
140
- }) => void;
141
- _getMapTouches(touches: TouchList): TouchList;
142
- handleEvent: (e: Event, eventName?: keyof Handler) => void;
143
- mergeHandlerResult(mergedHandlerResult: HandlerResult, eventsInProgress: EventsInProgress, handlerResult: HandlerResult, name: string, e?: UIEvent): void;
144
- _applyChanges(): void;
145
- _updateMapTransform(combinedResult: HandlerResult, combinedEventsInProgress: EventsInProgress, deactivatedHandlers: {
146
- [handlerName: string]: Event;
147
- }): void;
148
- _fireEvents(newEventsInProgress: EventsInProgress, deactivatedHandlers: {
149
- [handlerName: string]: Event;
150
- }, allowEndAnimation: boolean): void;
151
- _fireEvent(type: string, e?: Event): void;
152
- _requestFrame(): number;
153
- _triggerRenderFrame(): void;
154
- }