@antv/l7-map 2.17.12 → 2.18.0

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 (104) hide show
  1. package/es/camera.js +92 -149
  2. package/es/earthmap.js +15 -68
  3. package/es/geo/edge_insets.js +4 -14
  4. package/es/geo/lng_lat.js +5 -13
  5. package/es/geo/lng_lat_bounds.js +4 -17
  6. package/es/geo/mercator.js +2 -10
  7. package/es/geo/point.js +0 -7
  8. package/es/geo/simple.js +6 -11
  9. package/es/geo/transform.js +128 -138
  10. package/es/handler/blockable_map_event.js +7 -12
  11. package/es/handler/box_zoom.js +10 -30
  12. package/es/handler/click_zoom.js +0 -5
  13. package/es/handler/events/event.js +2 -3
  14. package/es/handler/events/map_mouse_event.js +2 -13
  15. package/es/handler/events/map_touch_event.js +2 -12
  16. package/es/handler/events/map_wheel_event.js +1 -12
  17. package/es/handler/events/render_event.js +0 -13
  18. package/es/handler/handler_inertia.js +8 -35
  19. package/es/handler/handler_manager.js +90 -197
  20. package/es/handler/handler_util.js +1 -2
  21. package/es/handler/keyboard.js +1 -20
  22. package/es/handler/map_event.js +3 -9
  23. package/es/handler/mouse/mouse_handler.js +11 -24
  24. package/es/handler/mouse/mousepan_handler.js +1 -11
  25. package/es/handler/mouse/mousepitch_hander.js +1 -11
  26. package/es/handler/mouse/mouserotate_hander.js +1 -11
  27. package/es/handler/mouse/util.js +2 -3
  28. package/es/handler/scroll_zoom.js +43 -71
  29. package/es/handler/shim/dblclick_zoom.js +4 -9
  30. package/es/handler/shim/drag_pan.js +6 -18
  31. package/es/handler/shim/drag_rotate.js +4 -10
  32. package/es/handler/shim/touch_zoom_rotate.js +8 -23
  33. package/es/handler/tap/single_tap_recognizer.js +8 -31
  34. package/es/handler/tap/tap_drag_zoom.js +7 -15
  35. package/es/handler/tap/tap_recognizer.js +3 -11
  36. package/es/handler/tap/tap_zoom.js +1 -7
  37. package/es/handler/touch/touch_pan.js +4 -22
  38. package/es/handler/touch/touch_pitch.js +10 -27
  39. package/es/handler/touch/touch_rotate.js +8 -19
  40. package/es/handler/touch/touch_zoom.js +5 -18
  41. package/es/handler/touch/two_touch.js +19 -32
  42. package/es/hash.js +13 -35
  43. package/es/map.js +30 -107
  44. package/es/util.d.ts +3 -3
  45. package/es/util.js +20 -33
  46. package/es/utils/Aabb.js +10 -31
  47. package/es/utils/dom.js +33 -111
  48. package/es/utils/performance.js +9 -9
  49. package/es/utils/primitives.js +13 -11
  50. package/es/utils/task_queue.js +6 -23
  51. package/lib/camera.js +102 -179
  52. package/lib/earthmap.js +14 -83
  53. package/lib/geo/edge_insets.js +3 -18
  54. package/lib/geo/lng_lat.js +5 -18
  55. package/lib/geo/lng_lat_bounds.js +4 -20
  56. package/lib/geo/mercator.js +1 -22
  57. package/lib/geo/point.js +0 -8
  58. package/lib/geo/simple.js +5 -24
  59. package/lib/geo/transform.js +128 -170
  60. package/lib/handler/blockable_map_event.js +6 -14
  61. package/lib/handler/box_zoom.js +8 -39
  62. package/lib/handler/click_zoom.js +0 -6
  63. package/lib/handler/events/event.js +4 -7
  64. package/lib/handler/events/index.js +0 -4
  65. package/lib/handler/events/map_mouse_event.js +5 -22
  66. package/lib/handler/events/map_touch_event.js +2 -21
  67. package/lib/handler/events/map_wheel_event.js +1 -16
  68. package/lib/handler/events/render_event.js +0 -19
  69. package/lib/handler/handler_inertia.js +13 -44
  70. package/lib/handler/handler_manager.js +92 -222
  71. package/lib/handler/handler_util.js +1 -3
  72. package/lib/handler/keyboard.js +1 -22
  73. package/lib/handler/map_event.js +2 -11
  74. package/lib/handler/mouse/index.js +0 -4
  75. package/lib/handler/mouse/mouse_handler.js +10 -27
  76. package/lib/handler/mouse/mousepan_handler.js +1 -18
  77. package/lib/handler/mouse/mousepitch_hander.js +1 -17
  78. package/lib/handler/mouse/mouserotate_hander.js +1 -17
  79. package/lib/handler/mouse/util.js +2 -6
  80. package/lib/handler/scroll_zoom.js +43 -77
  81. package/lib/handler/shim/dblclick_zoom.js +4 -10
  82. package/lib/handler/shim/drag_pan.js +6 -20
  83. package/lib/handler/shim/drag_rotate.js +4 -11
  84. package/lib/handler/shim/touch_zoom_rotate.js +8 -25
  85. package/lib/handler/tap/single_tap_recognizer.js +8 -33
  86. package/lib/handler/tap/tap_drag_zoom.js +6 -18
  87. package/lib/handler/tap/tap_recognizer.js +2 -17
  88. package/lib/handler/tap/tap_zoom.js +0 -9
  89. package/lib/handler/touch/index.js +0 -5
  90. package/lib/handler/touch/touch_pan.js +4 -25
  91. package/lib/handler/touch/touch_pitch.js +10 -32
  92. package/lib/handler/touch/touch_rotate.js +8 -25
  93. package/lib/handler/touch/touch_zoom.js +5 -24
  94. package/lib/handler/touch/two_touch.js +18 -35
  95. package/lib/hash.js +12 -38
  96. package/lib/index.js +0 -8
  97. package/lib/map.js +30 -125
  98. package/lib/util.js +19 -46
  99. package/lib/utils/Aabb.js +10 -34
  100. package/lib/utils/dom.js +32 -118
  101. package/lib/utils/performance.js +9 -11
  102. package/lib/utils/primitives.js +13 -16
  103. package/lib/utils/task_queue.js +6 -24
  104. package/package.json +4 -4
@@ -1,55 +1,40 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
14
  var _two_touch = _interopRequireDefault(require("./two_touch"));
23
-
24
15
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
-
26
- 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; } }
27
-
16
+ 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; } } // @ts-ignore
28
17
  var ROTATION_THRESHOLD = 25; // pixels along circumference of touch circle
29
18
 
30
19
  function getBearingDelta(a, b) {
31
20
  return a.angleWith(b) * 180 / Math.PI;
32
21
  }
33
-
34
22
  var TouchRotateHandler = /*#__PURE__*/function (_TwoTouchHandler) {
35
23
  (0, _inherits2.default)(TouchRotateHandler, _TwoTouchHandler);
36
-
37
24
  var _super = _createSuper(TouchRotateHandler);
38
-
39
25
  function TouchRotateHandler() {
40
26
  (0, _classCallCheck2.default)(this, TouchRotateHandler);
41
27
  return _super.apply(this, arguments);
42
28
  }
43
-
44
29
  (0, _createClass2.default)(TouchRotateHandler, [{
45
30
  key: "reset",
46
31
  value: function reset() {
47
- (0, _get2.default)((0, _getPrototypeOf2.default)(TouchRotateHandler.prototype), "reset", this).call(this); // @ts-ignore
48
-
49
- delete this.minDiameter; // @ts-ignore
50
-
51
- delete this.startVector; // @ts-ignore
52
-
32
+ (0, _get2.default)((0, _getPrototypeOf2.default)(TouchRotateHandler.prototype), "reset", this).call(this);
33
+ // @ts-ignore
34
+ delete this.minDiameter;
35
+ // @ts-ignore
36
+ delete this.startVector;
37
+ // @ts-ignore
53
38
  delete this.vector;
54
39
  }
55
40
  }, {
@@ -63,11 +48,9 @@ var TouchRotateHandler = /*#__PURE__*/function (_TwoTouchHandler) {
63
48
  value: function move(points, pinchAround) {
64
49
  var lastVector = this.vector;
65
50
  this.vector = points[0].sub(points[1]);
66
-
67
51
  if (!this.active && this.isBelowThreshold(this.vector)) {
68
52
  return;
69
53
  }
70
-
71
54
  this.active = true;
72
55
  return {
73
56
  bearingDelta: getBearingDelta(this.vector, lastVector),
@@ -86,6 +69,7 @@ var TouchRotateHandler = /*#__PURE__*/function (_TwoTouchHandler) {
86
69
  * Use the smallest diameter from the whole gesture to reduce sensitivity
87
70
  * when pinching in and out.
88
71
  */
72
+
89
73
  this.minDiameter = Math.min(this.minDiameter, vector.mag());
90
74
  var circumference = Math.PI * this.minDiameter;
91
75
  var threshold = ROTATION_THRESHOLD / circumference * 360;
@@ -95,5 +79,4 @@ var TouchRotateHandler = /*#__PURE__*/function (_TwoTouchHandler) {
95
79
  }]);
96
80
  return TouchRotateHandler;
97
81
  }(_two_touch.default);
98
-
99
82
  exports.default = TouchRotateHandler;
@@ -1,53 +1,37 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
14
  var _two_touch = _interopRequireDefault(require("./two_touch"));
23
-
24
15
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
-
26
- 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; } }
27
-
16
+ 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; } } // @ts-ignore
28
17
  var ZOOM_THRESHOLD = 0.1;
29
-
30
18
  function getZoomDelta(distance, lastDistance) {
31
19
  return Math.log(distance / lastDistance) / Math.LN2;
32
20
  }
33
-
34
21
  var TouchZoomHandler = /*#__PURE__*/function (_TwoTouchHandler) {
35
22
  (0, _inherits2.default)(TouchZoomHandler, _TwoTouchHandler);
36
-
37
23
  var _super = _createSuper(TouchZoomHandler);
38
-
39
24
  function TouchZoomHandler() {
40
25
  (0, _classCallCheck2.default)(this, TouchZoomHandler);
41
26
  return _super.apply(this, arguments);
42
27
  }
43
-
44
28
  (0, _createClass2.default)(TouchZoomHandler, [{
45
29
  key: "reset",
46
30
  value: function reset() {
47
- (0, _get2.default)((0, _getPrototypeOf2.default)(TouchZoomHandler.prototype), "reset", this).call(this); // @ts-ignore
48
-
49
- delete this.distance; // @ts-ignore
50
-
31
+ (0, _get2.default)((0, _getPrototypeOf2.default)(TouchZoomHandler.prototype), "reset", this).call(this);
32
+ // @ts-ignore
33
+ delete this.distance;
34
+ // @ts-ignore
51
35
  delete this.startDistance;
52
36
  }
53
37
  }, {
@@ -60,11 +44,9 @@ var TouchZoomHandler = /*#__PURE__*/function (_TwoTouchHandler) {
60
44
  value: function move(points, pinchAround) {
61
45
  var lastDistance = this.distance;
62
46
  this.distance = points[0].dist(points[1]);
63
-
64
47
  if (!this.active && Math.abs(getZoomDelta(this.distance, this.startDistance)) < ZOOM_THRESHOLD) {
65
48
  return;
66
49
  }
67
-
68
50
  this.active = true;
69
51
  return {
70
52
  zoomDelta: getZoomDelta(this.distance, lastDistance),
@@ -74,5 +56,4 @@ var TouchZoomHandler = /*#__PURE__*/function (_TwoTouchHandler) {
74
56
  }]);
75
57
  return TouchZoomHandler;
76
58
  }(_two_touch.default);
77
-
78
59
  exports.default = TouchZoomHandler;
@@ -1,50 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _dom = _interopRequireDefault(require("../../utils/dom"));
17
-
18
12
  // @ts-ignore
19
13
  var TwoTouchHandler = /*#__PURE__*/function () {
20
14
  function TwoTouchHandler() {
21
15
  (0, _classCallCheck2.default)(this, TwoTouchHandler);
22
16
  this.reset();
23
17
  }
24
-
25
18
  (0, _createClass2.default)(TwoTouchHandler, [{
26
19
  key: "reset",
27
20
  value: function reset() {
28
- this.active = false; // @ts-ignore
29
-
21
+ this.active = false;
22
+ // @ts-ignore
30
23
  delete this.firstTwoTouches;
31
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
-
24
+ }
25
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
26
  }, {
34
27
  key: "start",
35
28
  value: function start(points) {
36
29
  return;
37
30
  } // eslint-disable-line
38
-
39
31
  }, {
40
32
  key: "move",
41
- value: function move( // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- points, // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
- pinchAround, // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
+ value: function move(
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ points,
36
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
+ pinchAround,
38
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
39
  e) {
45
40
  return;
46
41
  } // eslint-disable-line
47
-
48
42
  }, {
49
43
  key: "touchstart",
50
44
  value: function touchstart(e, points, mapTouches) {
@@ -53,9 +47,9 @@ var TwoTouchHandler = /*#__PURE__*/function () {
53
47
  if (this.firstTwoTouches || mapTouches.length < 2) {
54
48
  return;
55
49
  }
50
+ this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier];
56
51
 
57
- this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier]; // implemented by child classes
58
-
52
+ // implemented by child classes
59
53
  this.start([points[0], points[1]]);
60
54
  }
61
55
  }, {
@@ -64,22 +58,18 @@ var TwoTouchHandler = /*#__PURE__*/function () {
64
58
  if (!this.firstTwoTouches) {
65
59
  return;
66
60
  }
67
-
68
61
  e.preventDefault();
69
-
70
62
  var _this$firstTwoTouches = (0, _slicedToArray2.default)(this.firstTwoTouches, 2),
71
- idA = _this$firstTwoTouches[0],
72
- idB = _this$firstTwoTouches[1];
73
-
63
+ idA = _this$firstTwoTouches[0],
64
+ idB = _this$firstTwoTouches[1];
74
65
  var a = getTouchById(mapTouches, points, idA);
75
66
  var b = getTouchById(mapTouches, points, idB);
76
-
77
67
  if (!a || !b) {
78
68
  return;
79
69
  }
70
+ var pinchAround = this.aroundCenter ? null : a.add(b).div(2);
80
71
 
81
- var pinchAround = this.aroundCenter ? null : a.add(b).div(2); // implemented by child classes
82
-
72
+ // implemented by child classes
83
73
  return this.move([a, b], pinchAround, e);
84
74
  }
85
75
  }, {
@@ -88,22 +78,17 @@ var TwoTouchHandler = /*#__PURE__*/function () {
88
78
  if (!this.firstTwoTouches) {
89
79
  return;
90
80
  }
91
-
92
81
  var _this$firstTwoTouches2 = (0, _slicedToArray2.default)(this.firstTwoTouches, 2),
93
- idA = _this$firstTwoTouches2[0],
94
- idB = _this$firstTwoTouches2[1];
95
-
82
+ idA = _this$firstTwoTouches2[0],
83
+ idB = _this$firstTwoTouches2[1];
96
84
  var a = getTouchById(mapTouches, points, idA);
97
85
  var b = getTouchById(mapTouches, points, idB);
98
-
99
86
  if (a && b) {
100
87
  return;
101
88
  }
102
-
103
89
  if (this.active) {
104
90
  _dom.default.suppressClick();
105
91
  }
106
-
107
92
  this.reset();
108
93
  }
109
94
  }, {
@@ -136,9 +121,7 @@ var TwoTouchHandler = /*#__PURE__*/function () {
136
121
  }]);
137
122
  return TwoTouchHandler;
138
123
  }();
139
-
140
124
  exports.default = TwoTouchHandler;
141
-
142
125
  function getTouchById(mapTouches, points, identifier) {
143
126
  for (var i = 0; i < mapTouches.length; i++) {
144
127
  if (mapTouches[i].identifier === identifier) {
package/lib/hash.js CHANGED
@@ -1,25 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
11
  var _l7Utils = require("@antv/l7-utils");
17
-
18
- var _lodash = require("lodash");
19
-
20
12
  // @ts-ignore
21
13
  // tslint:disable-next-line:no-submodule-imports
22
14
 
15
+ var throttle = _l7Utils.lodashUtil.throttle;
23
16
  /*
24
17
  * Adds the map's position to its page's location hash.
25
18
  * Passed as an option to the map object.
@@ -29,32 +22,26 @@ var _lodash = require("lodash");
29
22
  var Hash = /*#__PURE__*/function () {
30
23
  function Hash(hashName) {
31
24
  var _this = this;
32
-
33
25
  (0, _classCallCheck2.default)(this, Hash);
34
26
  (0, _defineProperty2.default)(this, "onHashChange", function () {
35
27
  var loc = _this.getCurrentHash();
36
-
37
28
  if (loc.length >= 3 && !loc.some(function (v) {
38
29
  return isNaN(+v);
39
30
  })) {
40
31
  var bearing = _this.map.dragRotate.isEnabled() && _this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : _this.map.getBearing();
41
-
42
32
  _this.map.jumpTo({
43
33
  center: [+loc[2], +loc[1]],
44
34
  zoom: +loc[0],
45
35
  bearing: bearing,
46
36
  pitch: +(loc[4] || 0)
47
37
  });
48
-
49
38
  return true;
50
39
  }
51
-
52
40
  return false;
53
41
  });
54
42
  (0, _defineProperty2.default)(this, "getCurrentHash", function () {
55
43
  // Get the current hash from location, stripped from its number sign
56
44
  var hash = window.location.hash.replace('#', '');
57
-
58
45
  if (_this.hashName) {
59
46
  // Split the parameter-styled hash into parts and find the value we need
60
47
  var keyval;
@@ -67,42 +54,39 @@ var Hash = /*#__PURE__*/function () {
67
54
  });
68
55
  return (keyval ? keyval[1] || '' : '').split('/');
69
56
  }
70
-
71
57
  return hash.split('/');
72
58
  });
73
59
  (0, _defineProperty2.default)(this, "updateHashUnthrottled", function () {
74
60
  var hash = _this.getHashString();
75
-
76
61
  try {
77
62
  window.history.replaceState(window.history.state, '', hash);
78
- } catch (SecurityError) {// IE11 does not allow this if the page is within an iframe created
63
+ } catch (SecurityError) {
64
+ // IE11 does not allow this if the page is within an iframe created
79
65
  // with iframe.contentWindow.document.write(...).
80
66
  // https://github.com/mapbox/mapbox-gl-js/issues/7410
81
67
  }
82
68
  });
83
- this.hashName = hashName && encodeURIComponent(hashName); // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
69
+ this.hashName = hashName && encodeURIComponent(hashName);
84
70
 
85
- this.updateHash = (0, _lodash.throttle)(this.updateHashUnthrottled, 30 * 1000 / 100);
71
+ // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
72
+ this.updateHash = throttle(this.updateHashUnthrottled, 30 * 1000 / 100);
86
73
  }
87
-
88
74
  (0, _createClass2.default)(Hash, [{
89
75
  key: "addTo",
90
76
  value: function addTo(map) {
91
77
  this.map = map;
92
-
93
- _l7Utils.$window.addEventListener('hashchange', this.onHashChange, false);
94
-
78
+ window.addEventListener('hashchange', this.onHashChange, false);
95
79
  this.map.on('moveend', this.updateHash);
96
80
  return this;
97
81
  }
98
82
  }, {
99
83
  key: "remove",
100
84
  value: function remove() {
101
- _l7Utils.$window.removeEventListener('hashchange', this.onHashChange, false);
85
+ window.removeEventListener('hashchange', this.onHashChange, false);
86
+ this.map.off('moveend', this.updateHash);
87
+ // clearTimeout(this.updateHash());
102
88
 
103
- this.map.off('moveend', this.updateHash); // clearTimeout(this.updateHash());
104
89
  // @ts-ignore
105
-
106
90
  delete this.map;
107
91
  return this;
108
92
  }
@@ -110,8 +94,8 @@ var Hash = /*#__PURE__*/function () {
110
94
  key: "getHashString",
111
95
  value: function getHashString(mapFeedback) {
112
96
  var center = this.map.getCenter();
113
- var zoom = Math.round(this.map.getZoom() * 100) / 100; // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
114
-
97
+ var zoom = Math.round(this.map.getZoom() * 100) / 100;
98
+ // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
115
99
  var precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
116
100
  var m = Math.pow(10, precision);
117
101
  var lng = Math.round(center.lng * m) / m;
@@ -119,7 +103,6 @@ var Hash = /*#__PURE__*/function () {
119
103
  var bearing = this.map.getBearing();
120
104
  var pitch = this.map.getPitch();
121
105
  var hash = '';
122
-
123
106
  if (mapFeedback) {
124
107
  // new map feedback site has some constraints that don't allow
125
108
  // us to use the same hash format as we do for the Map hash option.
@@ -127,43 +110,34 @@ var Hash = /*#__PURE__*/function () {
127
110
  } else {
128
111
  hash += "".concat(zoom, "/").concat(lat, "/").concat(lng);
129
112
  }
130
-
131
113
  if (bearing || pitch) {
132
114
  hash += "/".concat(Math.round(bearing * 10) / 10);
133
115
  }
134
-
135
116
  if (pitch) {
136
117
  hash += "/".concat(Math.round(pitch));
137
118
  }
138
-
139
119
  if (this.hashName) {
140
120
  var hashName = this.hashName;
141
121
  var found = false;
142
122
  var parts = window.location.hash.slice(1).split('&').map(function (part) {
143
123
  var key = part.split('=')[0];
144
-
145
124
  if (key === hashName) {
146
125
  found = true;
147
126
  return "".concat(key, "=").concat(hash);
148
127
  }
149
-
150
128
  return part;
151
129
  }).filter(function (a) {
152
130
  return a;
153
131
  });
154
-
155
132
  if (!found) {
156
133
  parts.push("".concat(hashName, "=").concat(hash));
157
134
  }
158
-
159
135
  return "#".concat(parts.join('&'));
160
136
  }
161
-
162
137
  return "#".concat(hash);
163
138
  }
164
139
  }]);
165
140
  return Hash;
166
141
  }();
167
-
168
142
  var _default = Hash;
169
143
  exports.default = _default;
package/lib/index.js CHANGED
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _earthmap = require("./earthmap");
8
-
9
7
  Object.keys(_earthmap).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _earthmap[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_earthmap).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _mercator = require("./geo/mercator");
21
-
22
18
  Object.keys(_mercator).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _mercator[key]) return;
@@ -29,9 +25,7 @@ Object.keys(_mercator).forEach(function (key) {
29
25
  }
30
26
  });
31
27
  });
32
-
33
28
  var _interface = require("./interface");
34
-
35
29
  Object.keys(_interface).forEach(function (key) {
36
30
  if (key === "default" || key === "__esModule") return;
37
31
  if (key in exports && exports[key] === _interface[key]) return;
@@ -42,9 +36,7 @@ Object.keys(_interface).forEach(function (key) {
42
36
  }
43
37
  });
44
38
  });
45
-
46
39
  var _map = require("./map");
47
-
48
40
  Object.keys(_map).forEach(function (key) {
49
41
  if (key === "default" || key === "__esModule") return;
50
42
  if (key in exports && exports[key] === _map[key]) return;