@antv/l7-map 2.17.12 → 2.18.2

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 (168) hide show
  1. package/package.json +4 -4
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -775
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -422
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -92
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -92
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -131
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -138
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -464
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -101
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -801
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -445
  116. package/lib/geo/edge_insets.js +0 -129
  117. package/lib/geo/lng_lat.js +0 -94
  118. package/lib/geo/lng_lat_bounds.js +0 -177
  119. package/lib/geo/mercator.js +0 -121
  120. package/lib/geo/point.js +0 -239
  121. package/lib/geo/simple.js +0 -123
  122. package/lib/geo/transform.js +0 -1013
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -92
  125. package/lib/handler/box_zoom.js +0 -217
  126. package/lib/handler/click_zoom.js +0 -67
  127. package/lib/handler/events/event.js +0 -23
  128. package/lib/handler/events/index.js +0 -31
  129. package/lib/handler/events/map_mouse_event.js +0 -87
  130. package/lib/handler/events/map_touch_event.js +0 -119
  131. package/lib/handler/events/map_wheel_event.js +0 -72
  132. package/lib/handler/events/render_event.js +0 -52
  133. package/lib/handler/handler_inertia.js +0 -193
  134. package/lib/handler/handler_manager.js +0 -714
  135. package/lib/handler/handler_util.js +0 -17
  136. package/lib/handler/keyboard.js +0 -172
  137. package/lib/handler/map_event.js +0 -140
  138. package/lib/handler/mouse/index.js +0 -31
  139. package/lib/handler/mouse/mouse_handler.js +0 -141
  140. package/lib/handler/mouse/mousepan_handler.js +0 -66
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -67
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -67
  143. package/lib/handler/mouse/util.js +0 -26
  144. package/lib/handler/scroll_zoom.js +0 -367
  145. package/lib/handler/shim/dblclick_zoom.js +0 -80
  146. package/lib/handler/shim/drag_pan.js +0 -105
  147. package/lib/handler/shim/drag_rotate.js +0 -88
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -139
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -131
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -124
  151. package/lib/handler/tap/tap_recognizer.js +0 -78
  152. package/lib/handler/tap/tap_zoom.js +0 -124
  153. package/lib/handler/touch/index.js +0 -39
  154. package/lib/handler/touch/touch_pan.js +0 -138
  155. package/lib/handler/touch/touch_pitch.js +0 -120
  156. package/lib/handler/touch/touch_rotate.js +0 -99
  157. package/lib/handler/touch/touch_zoom.js +0 -78
  158. package/lib/handler/touch/two_touch.js +0 -148
  159. package/lib/hash.js +0 -169
  160. package/lib/index.js +0 -57
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -135
  164. package/lib/utils/Aabb.js +0 -143
  165. package/lib/utils/dom.js +0 -233
  166. package/lib/utils/performance.js +0 -72
  167. package/lib/utils/primitives.js +0 -57
  168. package/lib/utils/task_queue.js +0 -115
@@ -1,105 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
-
7
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
- // @ts-ignore
12
- import Point from "../../geo/point";
13
- import DOM from "../../utils/dom";
14
- import { Event } from "./event";
15
-
16
- var MapTouchEvent = /*#__PURE__*/function (_Event) {
17
- _inherits(MapTouchEvent, _Event);
18
-
19
- var _super = _createSuper(MapTouchEvent);
20
-
21
- /**
22
- * The event type.
23
- */
24
-
25
- /**
26
- * The `Map` object that fired the event.
27
- */
28
-
29
- /**
30
- * The DOM event which caused the map event.
31
- */
32
-
33
- /**
34
- * The geographic location on the map of the center of the touch event points.
35
- */
36
-
37
- /**
38
- * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
39
- * corner.
40
- */
41
-
42
- /**
43
- * The array of pixel coordinates corresponding to a
44
- * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
45
- */
46
-
47
- /**
48
- * The geographical locations on the map corresponding to a
49
- * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
50
- */
51
-
52
- /**
53
- * `true` if `preventDefault` has been called.
54
- * @private
55
- */
56
-
57
- /**
58
- * @private
59
- */
60
- function MapTouchEvent(type, map, originalEvent) {
61
- var _this;
62
-
63
- _classCallCheck(this, MapTouchEvent);
64
-
65
- var touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;
66
- var points = DOM.touchPos(map.getCanvasContainer(), touches);
67
- var lngLats = points.map(function (t) {
68
- return map.unproject(t);
69
- });
70
- var point = points.reduce(function (prev, curr, i, arr) {
71
- return prev.add(curr.div(arr.length));
72
- }, new Point(0, 0));
73
- var lngLat = map.unproject(point);
74
- _this = _super.call(this, type, {
75
- points: points,
76
- point: point,
77
- lngLats: lngLats,
78
- lngLat: lngLat,
79
- originalEvent: originalEvent
80
- });
81
- _this.defaultPrevented = false;
82
- return _this;
83
- }
84
- /**
85
- * Prevents subsequent default processing of the event by the map.
86
- *
87
- * Calling this method will prevent the following default map behaviors:
88
- *
89
- * * On `touchstart` events, the behavior of {@link DragPanHandler}
90
- * * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
91
- *
92
- */
93
-
94
-
95
- _createClass(MapTouchEvent, [{
96
- key: "preventDefault",
97
- value: function preventDefault() {
98
- this.defaultPrevented = true;
99
- }
100
- }]);
101
-
102
- return MapTouchEvent;
103
- }(Event);
104
-
105
- export { MapTouchEvent as default };
@@ -1,33 +0,0 @@
1
- import { EarthMap } from '../../earthmap';
2
- import { Map } from '../../map';
3
- import { Event } from './event';
4
- export interface IMapBoxZoomEvent {
5
- type: 'boxzoomstart' | 'boxzoomend' | 'boxzoomcancel';
6
- target: Map | EarthMap;
7
- originalEvent: MouseEvent;
8
- }
9
- export default class MapWheelEvent extends Event {
10
- /**
11
- * The event type.
12
- */
13
- type: 'wheel';
14
- /**
15
- * The DOM event which caused the map event.
16
- */
17
- originalEvent: WheelEvent;
18
- defaultPrevented: boolean;
19
- /**
20
- * The `Map` object that fired the event.
21
- */
22
- target: Map | EarthMap;
23
- /**
24
- * @private
25
- */
26
- constructor(type: string, map: Map | EarthMap, originalEvent: WheelEvent);
27
- /**
28
- * Prevents subsequent default processing of the event by the map.
29
- *
30
- * Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
31
- */
32
- private preventDefault;
33
- }
@@ -1,61 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
-
7
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
- import { Event } from "./event";
12
-
13
- var MapWheelEvent = /*#__PURE__*/function (_Event) {
14
- _inherits(MapWheelEvent, _Event);
15
-
16
- var _super = _createSuper(MapWheelEvent);
17
-
18
- /**
19
- * The event type.
20
- */
21
-
22
- /**
23
- * The DOM event which caused the map event.
24
- */
25
-
26
- /**
27
- * The `Map` object that fired the event.
28
- */
29
-
30
- /**
31
- * @private
32
- */
33
- function MapWheelEvent(type, map, originalEvent) {
34
- var _this;
35
-
36
- _classCallCheck(this, MapWheelEvent);
37
-
38
- _this = _super.call(this, type, {
39
- originalEvent: originalEvent
40
- });
41
- _this.defaultPrevented = false;
42
- return _this;
43
- }
44
- /**
45
- * Prevents subsequent default processing of the event by the map.
46
- *
47
- * Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
48
- */
49
-
50
-
51
- _createClass(MapWheelEvent, [{
52
- key: "preventDefault",
53
- value: function preventDefault() {
54
- this.defaultPrevented = true;
55
- }
56
- }]);
57
-
58
- return MapWheelEvent;
59
- }(Event);
60
-
61
- export { MapWheelEvent as default };
@@ -1,5 +0,0 @@
1
- import { Event } from './event';
2
- export default class RenderFrameEvent extends Event {
3
- type: string;
4
- timeStamp: number;
5
- }
@@ -1,39 +0,0 @@
1
- import _createClass from "@babel/runtime/helpers/esm/createClass";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
-
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
-
13
- import { Event } from "./event";
14
-
15
- var RenderFrameEvent = /*#__PURE__*/function (_Event) {
16
- _inherits(RenderFrameEvent, _Event);
17
-
18
- var _super = _createSuper(RenderFrameEvent);
19
-
20
- function RenderFrameEvent() {
21
- var _this;
22
-
23
- _classCallCheck(this, RenderFrameEvent);
24
-
25
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
- args[_key] = arguments[_key];
27
- }
28
-
29
- _this = _super.call.apply(_super, [this].concat(args));
30
-
31
- _defineProperty(_assertThisInitialized(_this), "type", 'renderFrame');
32
-
33
- return _this;
34
- }
35
-
36
- return _createClass(RenderFrameEvent);
37
- }(Event);
38
-
39
- export { RenderFrameEvent as default };
@@ -1,23 +0,0 @@
1
- import { EarthMap } from '../earthmap';
2
- import { Map } from '../map';
3
- import { IDragPanOptions } from './shim/drag_pan';
4
- export interface IInertiaOptions {
5
- linearity: number;
6
- easing: (t: number) => number;
7
- deceleration: number;
8
- maxSpeed: number;
9
- }
10
- export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
11
- export default class HandlerInertia {
12
- private map;
13
- private inertiaBuffer;
14
- constructor(map: Map | EarthMap);
15
- clear(): void;
16
- record(settings: any): void;
17
- drainInertiaBuffer(): void;
18
- onMoveEnd(panInertiaOptions?: IDragPanOptions): ({
19
- [key: string]: any;
20
- } & {
21
- noMoveStart: boolean;
22
- }) | undefined;
23
- }
@@ -1,184 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
-
4
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5
-
6
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
-
8
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
9
-
10
- // @ts-ignore
11
- import Point from "../geo/point"; // tslint:disable-next-line:no-submodule-imports
12
-
13
- import merge from 'lodash/merge';
14
- import { bezier, clamp, now } from "../util";
15
- var defaultInertiaOptions = {
16
- linearity: 0.3,
17
- easing: bezier(0, 0, 0.3, 1)
18
- };
19
- var defaultPanInertiaOptions = merge({
20
- deceleration: 2500,
21
- maxSpeed: 1400
22
- }, defaultInertiaOptions);
23
- var defaultZoomInertiaOptions = merge({
24
- deceleration: 20,
25
- maxSpeed: 1400
26
- }, defaultInertiaOptions);
27
- var defaultBearingInertiaOptions = merge({
28
- deceleration: 1000,
29
- maxSpeed: 360
30
- }, defaultInertiaOptions);
31
- var defaultPitchInertiaOptions = merge({
32
- deceleration: 1000,
33
- maxSpeed: 90
34
- }, defaultInertiaOptions);
35
-
36
- var HandlerInertia = /*#__PURE__*/function () {
37
- function HandlerInertia(map) {
38
- _classCallCheck(this, HandlerInertia);
39
-
40
- this.map = map;
41
- this.clear();
42
- }
43
-
44
- _createClass(HandlerInertia, [{
45
- key: "clear",
46
- value: function clear() {
47
- this.inertiaBuffer = [];
48
- }
49
- }, {
50
- key: "record",
51
- value: function record(settings) {
52
- this.drainInertiaBuffer();
53
- this.inertiaBuffer.push({
54
- time: now(),
55
- settings: settings
56
- });
57
- }
58
- }, {
59
- key: "drainInertiaBuffer",
60
- value: function drainInertiaBuffer() {
61
- var inertia = this.inertiaBuffer;
62
- var nowTime = now();
63
- var cutoff = 160; // msec
64
-
65
- while (inertia.length > 0 && nowTime - inertia[0].time > cutoff) {
66
- inertia.shift();
67
- }
68
- }
69
- }, {
70
- key: "onMoveEnd",
71
- value: function onMoveEnd(panInertiaOptions) {
72
- this.drainInertiaBuffer();
73
-
74
- if (this.inertiaBuffer.length < 2) {
75
- return;
76
- }
77
-
78
- var deltas = {
79
- zoom: 0,
80
- bearing: 0,
81
- pitch: 0,
82
- pan: new Point(0, 0),
83
- pinchAround: undefined,
84
- around: undefined
85
- };
86
-
87
- var _iterator = _createForOfIteratorHelper(this.inertiaBuffer),
88
- _step;
89
-
90
- try {
91
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
92
- var settings = _step.value.settings;
93
- deltas.zoom += settings.zoomDelta || 0;
94
- deltas.bearing += settings.bearingDelta || 0;
95
- deltas.pitch += settings.pitchDelta || 0;
96
-
97
- if (settings.panDelta) {
98
- deltas.pan._add(settings.panDelta);
99
- }
100
-
101
- if (settings.around) {
102
- deltas.around = settings.around;
103
- }
104
-
105
- if (settings.pinchAround) {
106
- deltas.pinchAround = settings.pinchAround;
107
- }
108
- }
109
- } catch (err) {
110
- _iterator.e(err);
111
- } finally {
112
- _iterator.f();
113
- }
114
-
115
- var lastEntry = this.inertiaBuffer[this.inertiaBuffer.length - 1];
116
- var duration = lastEntry.time - this.inertiaBuffer[0].time;
117
- var easeOptions = {};
118
-
119
- if (deltas.pan.mag()) {
120
- var result = calculateEasing(deltas.pan.mag(), duration, merge({}, defaultPanInertiaOptions, panInertiaOptions || {}));
121
- easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());
122
- easeOptions.center = this.map.transform.center;
123
- extendDuration(easeOptions, result);
124
- }
125
-
126
- if (deltas.zoom) {
127
- var _result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);
128
-
129
- easeOptions.zoom = this.map.transform.zoom + _result.amount;
130
- extendDuration(easeOptions, _result);
131
- }
132
-
133
- if (deltas.bearing) {
134
- var _result2 = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);
135
-
136
- easeOptions.bearing = this.map.transform.bearing + clamp(_result2.amount, -179, 179);
137
- extendDuration(easeOptions, _result2);
138
- }
139
-
140
- if (deltas.pitch) {
141
- var _result3 = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);
142
-
143
- easeOptions.pitch = this.map.transform.pitch + _result3.amount;
144
- extendDuration(easeOptions, _result3);
145
- }
146
-
147
- if (easeOptions.zoom || easeOptions.bearing) {
148
- var last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;
149
- easeOptions.around = last ? this.map.unproject(last) : this.map.getCenter();
150
- }
151
-
152
- this.clear();
153
- return merge(easeOptions, {
154
- noMoveStart: true
155
- });
156
- }
157
- }]);
158
-
159
- return HandlerInertia;
160
- }(); // Unfortunately zoom, bearing, etc can't have different durations and easings so
161
- // we need to choose one. We use the longest duration and it's corresponding easing.
162
-
163
-
164
- export { HandlerInertia as default };
165
-
166
- function extendDuration(easeOptions, result) {
167
- if (!easeOptions.duration || easeOptions.duration < result.duration) {
168
- easeOptions.duration = result.duration;
169
- easeOptions.easing = result.easing;
170
- }
171
- }
172
-
173
- function calculateEasing(amount, inertiaDuration, inertiaOptions) {
174
- var maxSpeed = inertiaOptions.maxSpeed,
175
- linearity = inertiaOptions.linearity,
176
- deceleration = inertiaOptions.deceleration;
177
- var speed = clamp(amount * linearity / (inertiaDuration / 1000), -maxSpeed, maxSpeed);
178
- var duration = Math.abs(speed) / (deceleration * linearity);
179
- return {
180
- easing: inertiaOptions.easing,
181
- duration: duration * 1000,
182
- amount: speed * (duration / 2)
183
- };
184
- }
@@ -1,61 +0,0 @@
1
- import { EarthMap } from '../earthmap';
2
- import { Map } from '../map';
3
- import RenderFrameEvent from './events/render_event';
4
- import { IHandlerResult } from './IHandler';
5
- export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
6
- export interface IHandlerOptions {
7
- interactive: boolean;
8
- boxZoom: boolean;
9
- dragRotate: boolean;
10
- dragPan: boolean;
11
- keyboard: boolean;
12
- doubleClickZoom: boolean;
13
- touchZoomRotate: boolean;
14
- touchPitch: boolean;
15
- trackResize: boolean;
16
- renderWorldCopies: boolean;
17
- bearingSnap: number;
18
- clickTolerance: number;
19
- pitchWithRotate: boolean;
20
- pitchEnabled: boolean;
21
- rotateEnabled: boolean;
22
- }
23
- declare class HandlerManager {
24
- private map;
25
- private el;
26
- private handlers;
27
- private eventsInProgress;
28
- private frameId;
29
- private inertia;
30
- private bearingSnap;
31
- private handlersById;
32
- private updatingCamera;
33
- private changes;
34
- private previousActiveHandlers;
35
- private bearingChanged;
36
- private rotateEnabled;
37
- private pitchEnabled;
38
- private listeners;
39
- constructor(map: Map | EarthMap, options: IHandlerOptions);
40
- destroy(): void;
41
- stop(): void;
42
- isActive(): boolean;
43
- isZooming(): boolean;
44
- isRotating(): boolean;
45
- isMoving(): boolean;
46
- handleWindowEvent: (e: InputEvent) => void;
47
- handleEvent: (e: InputEvent | RenderFrameEvent, eventName?: string) => void;
48
- mergeIHandlerResult(mergedIHandlerResult: IHandlerResult, eventsInProgress: {
49
- [key: string]: any;
50
- }, HandlerResult: IHandlerResult, name: string, e?: InputEvent): void;
51
- triggerRenderFrame(): void;
52
- private addDefaultHandlers;
53
- private add;
54
- private blockedByActive;
55
- private getMapTouches;
56
- private applyChanges;
57
- private updateMapTransform;
58
- private fireEvents;
59
- private fireEvent;
60
- }
61
- export default HandlerManager;