@antv/l7-map 2.18.0 → 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 +3 -3
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -718
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -369
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -108
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -73
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -154
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -84
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -224
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -87
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -961
  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 -78
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -180
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -54
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -11
  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 -64
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -95
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -50
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -26
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -157
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -577
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -9
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -143
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -125
  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 -118
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -44
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -46
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -46
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -11
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -325
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -67
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -84
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -74
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -115
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -97
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -106
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -54
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -109
  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 -110
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -93
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -77
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -54
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -125
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -134
  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 -387
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -88
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -112
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -140
  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 -47
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -89
  113. package/lib/camera.js +0 -724
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -376
  116. package/lib/geo/edge_insets.js +0 -114
  117. package/lib/geo/lng_lat.js +0 -81
  118. package/lib/geo/lng_lat_bounds.js +0 -161
  119. package/lib/geo/mercator.js +0 -100
  120. package/lib/geo/point.js +0 -231
  121. package/lib/geo/simple.js +0 -104
  122. package/lib/geo/transform.js +0 -971
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -84
  125. package/lib/handler/box_zoom.js +0 -186
  126. package/lib/handler/click_zoom.js +0 -61
  127. package/lib/handler/events/event.js +0 -20
  128. package/lib/handler/events/index.js +0 -27
  129. package/lib/handler/events/map_mouse_event.js +0 -70
  130. package/lib/handler/events/map_touch_event.js +0 -100
  131. package/lib/handler/events/map_wheel_event.js +0 -57
  132. package/lib/handler/events/render_event.js +0 -33
  133. package/lib/handler/handler_inertia.js +0 -162
  134. package/lib/handler/handler_manager.js +0 -584
  135. package/lib/handler/handler_util.js +0 -15
  136. package/lib/handler/keyboard.js +0 -151
  137. package/lib/handler/map_event.js +0 -131
  138. package/lib/handler/mouse/index.js +0 -27
  139. package/lib/handler/mouse/mouse_handler.js +0 -124
  140. package/lib/handler/mouse/mousepan_handler.js +0 -49
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -51
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -51
  143. package/lib/handler/mouse/util.js +0 -22
  144. package/lib/handler/scroll_zoom.js +0 -333
  145. package/lib/handler/shim/dblclick_zoom.js +0 -74
  146. package/lib/handler/shim/drag_pan.js +0 -91
  147. package/lib/handler/shim/drag_rotate.js +0 -81
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -122
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -106
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -112
  151. package/lib/handler/tap/tap_recognizer.js +0 -63
  152. package/lib/handler/tap/tap_zoom.js +0 -115
  153. package/lib/handler/touch/index.js +0 -34
  154. package/lib/handler/touch/touch_pan.js +0 -117
  155. package/lib/handler/touch/touch_pitch.js +0 -98
  156. package/lib/handler/touch/touch_rotate.js +0 -82
  157. package/lib/handler/touch/touch_zoom.js +0 -59
  158. package/lib/handler/touch/two_touch.js +0 -131
  159. package/lib/hash.js +0 -143
  160. package/lib/index.js +0 -49
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -394
  163. package/lib/util.js +0 -108
  164. package/lib/utils/Aabb.js +0 -119
  165. package/lib/utils/dom.js +0 -147
  166. package/lib/utils/performance.js +0 -70
  167. package/lib/utils/primitives.js +0 -54
  168. package/lib/utils/task_queue.js +0 -97
@@ -1,95 +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
- 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); }; }
7
- 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; } }
8
- // @ts-ignore
9
-
10
- import Point from "../../geo/point";
11
- import DOM from "../../utils/dom";
12
- import { Event } from "./event";
13
- var MapTouchEvent = /*#__PURE__*/function (_Event) {
14
- _inherits(MapTouchEvent, _Event);
15
- var _super = _createSuper(MapTouchEvent);
16
- /**
17
- * The event type.
18
- */
19
-
20
- /**
21
- * The `Map` object that fired the event.
22
- */
23
-
24
- /**
25
- * The DOM event which caused the map event.
26
- */
27
-
28
- /**
29
- * The geographic location on the map of the center of the touch event points.
30
- */
31
-
32
- /**
33
- * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
34
- * corner.
35
- */
36
-
37
- /**
38
- * The array of pixel coordinates corresponding to a
39
- * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
40
- */
41
-
42
- /**
43
- * The geographical locations on the map corresponding to a
44
- * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
45
- */
46
-
47
- /**
48
- * `true` if `preventDefault` has been called.
49
- * @private
50
- */
51
-
52
- /**
53
- * @private
54
- */
55
- function MapTouchEvent(type, map, originalEvent) {
56
- var _this;
57
- _classCallCheck(this, MapTouchEvent);
58
- var touches = type === 'touchend' ? originalEvent.changedTouches : originalEvent.touches;
59
- var points = DOM.touchPos(map.getCanvasContainer(), touches);
60
- var lngLats = points.map(function (t) {
61
- return map.unproject(t);
62
- });
63
- var point = points.reduce(function (prev, curr, i, arr) {
64
- return prev.add(curr.div(arr.length));
65
- }, new Point(0, 0));
66
- var lngLat = map.unproject(point);
67
- _this = _super.call(this, type, {
68
- points: points,
69
- point: point,
70
- lngLats: lngLats,
71
- lngLat: lngLat,
72
- originalEvent: originalEvent
73
- });
74
- _this.defaultPrevented = false;
75
- return _this;
76
- }
77
-
78
- /**
79
- * Prevents subsequent default processing of the event by the map.
80
- *
81
- * Calling this method will prevent the following default map behaviors:
82
- *
83
- * * On `touchstart` events, the behavior of {@link DragPanHandler}
84
- * * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
85
- *
86
- */
87
- _createClass(MapTouchEvent, [{
88
- key: "preventDefault",
89
- value: function preventDefault() {
90
- this.defaultPrevented = true;
91
- }
92
- }]);
93
- return MapTouchEvent;
94
- }(Event);
95
- 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,50 +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
- 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); }; }
7
- 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; } }
8
- import { Event } from "./event";
9
- var MapWheelEvent = /*#__PURE__*/function (_Event) {
10
- _inherits(MapWheelEvent, _Event);
11
- var _super = _createSuper(MapWheelEvent);
12
- /**
13
- * The event type.
14
- */
15
-
16
- /**
17
- * The DOM event which caused the map event.
18
- */
19
-
20
- /**
21
- * The `Map` object that fired the event.
22
- */
23
-
24
- /**
25
- * @private
26
- */
27
- function MapWheelEvent(type, map, originalEvent) {
28
- var _this;
29
- _classCallCheck(this, MapWheelEvent);
30
- _this = _super.call(this, type, {
31
- originalEvent: originalEvent
32
- });
33
- _this.defaultPrevented = false;
34
- return _this;
35
- }
36
-
37
- /**
38
- * Prevents subsequent default processing of the event by the map.
39
- *
40
- * Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
41
- */
42
- _createClass(MapWheelEvent, [{
43
- key: "preventDefault",
44
- value: function preventDefault() {
45
- this.defaultPrevented = true;
46
- }
47
- }]);
48
- return MapWheelEvent;
49
- }(Event);
50
- 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,26 +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
- 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); }; }
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
- import { Event } from "./event";
11
- var RenderFrameEvent = /*#__PURE__*/function (_Event) {
12
- _inherits(RenderFrameEvent, _Event);
13
- var _super = _createSuper(RenderFrameEvent);
14
- function RenderFrameEvent() {
15
- var _this;
16
- _classCallCheck(this, RenderFrameEvent);
17
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
- args[_key] = arguments[_key];
19
- }
20
- _this = _super.call.apply(_super, [this].concat(args));
21
- _defineProperty(_assertThisInitialized(_this), "type", 'renderFrame');
22
- return _this;
23
- }
24
- return _createClass(RenderFrameEvent);
25
- }(Event);
26
- 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,157 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- 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; } } }; }
4
- 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); }
5
- 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; }
6
- // @ts-ignore
7
- import Point from "../geo/point";
8
-
9
- // tslint:disable-next-line:no-submodule-imports
10
- import { lodashUtil } from '@antv/l7-utils';
11
- import { bezier, clamp, now } from "../util";
12
- var merge = lodashUtil.merge;
13
- var defaultInertiaOptions = {
14
- linearity: 0.3,
15
- easing: bezier(0, 0, 0.3, 1)
16
- };
17
- var defaultPanInertiaOptions = merge({
18
- deceleration: 2500,
19
- maxSpeed: 1400
20
- }, defaultInertiaOptions);
21
- var defaultZoomInertiaOptions = merge({
22
- deceleration: 20,
23
- maxSpeed: 1400
24
- }, defaultInertiaOptions);
25
- var defaultBearingInertiaOptions = merge({
26
- deceleration: 1000,
27
- maxSpeed: 360
28
- }, defaultInertiaOptions);
29
- var defaultPitchInertiaOptions = merge({
30
- deceleration: 1000,
31
- maxSpeed: 90
32
- }, defaultInertiaOptions);
33
- var HandlerInertia = /*#__PURE__*/function () {
34
- function HandlerInertia(map) {
35
- _classCallCheck(this, HandlerInertia);
36
- this.map = map;
37
- this.clear();
38
- }
39
- _createClass(HandlerInertia, [{
40
- key: "clear",
41
- value: function clear() {
42
- this.inertiaBuffer = [];
43
- }
44
- }, {
45
- key: "record",
46
- value: function record(settings) {
47
- this.drainInertiaBuffer();
48
- this.inertiaBuffer.push({
49
- time: now(),
50
- settings: settings
51
- });
52
- }
53
- }, {
54
- key: "drainInertiaBuffer",
55
- value: function drainInertiaBuffer() {
56
- var inertia = this.inertiaBuffer;
57
- var nowTime = now();
58
- var cutoff = 160; // msec
59
-
60
- while (inertia.length > 0 && nowTime - inertia[0].time > cutoff) {
61
- inertia.shift();
62
- }
63
- }
64
- }, {
65
- key: "onMoveEnd",
66
- value: function onMoveEnd(panInertiaOptions) {
67
- this.drainInertiaBuffer();
68
- if (this.inertiaBuffer.length < 2) {
69
- return;
70
- }
71
- var deltas = {
72
- zoom: 0,
73
- bearing: 0,
74
- pitch: 0,
75
- pan: new Point(0, 0),
76
- pinchAround: undefined,
77
- around: undefined
78
- };
79
- var _iterator = _createForOfIteratorHelper(this.inertiaBuffer),
80
- _step;
81
- try {
82
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
83
- var settings = _step.value.settings;
84
- deltas.zoom += settings.zoomDelta || 0;
85
- deltas.bearing += settings.bearingDelta || 0;
86
- deltas.pitch += settings.pitchDelta || 0;
87
- if (settings.panDelta) {
88
- deltas.pan._add(settings.panDelta);
89
- }
90
- if (settings.around) {
91
- deltas.around = settings.around;
92
- }
93
- if (settings.pinchAround) {
94
- deltas.pinchAround = settings.pinchAround;
95
- }
96
- }
97
- } catch (err) {
98
- _iterator.e(err);
99
- } finally {
100
- _iterator.f();
101
- }
102
- var lastEntry = this.inertiaBuffer[this.inertiaBuffer.length - 1];
103
- var duration = lastEntry.time - this.inertiaBuffer[0].time;
104
- var easeOptions = {};
105
- if (deltas.pan.mag()) {
106
- var result = calculateEasing(deltas.pan.mag(), duration, merge({}, defaultPanInertiaOptions, panInertiaOptions || {}));
107
- easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());
108
- easeOptions.center = this.map.transform.center;
109
- extendDuration(easeOptions, result);
110
- }
111
- if (deltas.zoom) {
112
- var _result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);
113
- easeOptions.zoom = this.map.transform.zoom + _result.amount;
114
- extendDuration(easeOptions, _result);
115
- }
116
- if (deltas.bearing) {
117
- var _result2 = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);
118
- easeOptions.bearing = this.map.transform.bearing + clamp(_result2.amount, -179, 179);
119
- extendDuration(easeOptions, _result2);
120
- }
121
- if (deltas.pitch) {
122
- var _result3 = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);
123
- easeOptions.pitch = this.map.transform.pitch + _result3.amount;
124
- extendDuration(easeOptions, _result3);
125
- }
126
- if (easeOptions.zoom || easeOptions.bearing) {
127
- var last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;
128
- easeOptions.around = last ? this.map.unproject(last) : this.map.getCenter();
129
- }
130
- this.clear();
131
- return merge(easeOptions, {
132
- noMoveStart: true
133
- });
134
- }
135
- }]);
136
- return HandlerInertia;
137
- }(); // Unfortunately zoom, bearing, etc can't have different durations and easings so
138
- // we need to choose one. We use the longest duration and it's corresponding easing.
139
- export { HandlerInertia as default };
140
- function extendDuration(easeOptions, result) {
141
- if (!easeOptions.duration || easeOptions.duration < result.duration) {
142
- easeOptions.duration = result.duration;
143
- easeOptions.easing = result.easing;
144
- }
145
- }
146
- function calculateEasing(amount, inertiaDuration, inertiaOptions) {
147
- var maxSpeed = inertiaOptions.maxSpeed,
148
- linearity = inertiaOptions.linearity,
149
- deceleration = inertiaOptions.deceleration;
150
- var speed = clamp(amount * linearity / (inertiaDuration / 1000), -maxSpeed, maxSpeed);
151
- var duration = Math.abs(speed) / (deceleration * linearity);
152
- return {
153
- easing: inertiaOptions.easing,
154
- duration: duration * 1000,
155
- amount: speed * (duration / 2)
156
- };
157
- }
@@ -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;