@antv/l7-map 2.15.2 → 2.15.3

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 (103) hide show
  1. package/es/camera.js +90 -148
  2. package/es/earthmap.js +13 -65
  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 +123 -132
  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 +0 -2
  14. package/es/handler/events/map_mouse_event.js +0 -12
  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 +6 -34
  19. package/es/handler/handler_manager.js +55 -147
  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 +4 -11
  31. package/es/handler/shim/drag_rotate.js +4 -10
  32. package/es/handler/shim/touch_zoom_rotate.js +6 -16
  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 +9 -31
  43. package/es/map.js +16 -78
  44. package/es/util.js +18 -23
  45. package/es/utils/Aabb.js +10 -31
  46. package/es/utils/dom.js +24 -58
  47. package/es/utils/performance.js +8 -7
  48. package/es/utils/primitives.js +13 -11
  49. package/es/utils/task_queue.js +6 -23
  50. package/lib/camera.js +90 -168
  51. package/lib/earthmap.js +11 -79
  52. package/lib/geo/edge_insets.js +3 -18
  53. package/lib/geo/lng_lat.js +5 -18
  54. package/lib/geo/lng_lat_bounds.js +4 -20
  55. package/lib/geo/mercator.js +1 -22
  56. package/lib/geo/point.js +0 -8
  57. package/lib/geo/simple.js +5 -24
  58. package/lib/geo/transform.js +123 -164
  59. package/lib/handler/blockable_map_event.js +6 -14
  60. package/lib/handler/box_zoom.js +8 -39
  61. package/lib/handler/click_zoom.js +0 -6
  62. package/lib/handler/events/event.js +0 -5
  63. package/lib/handler/events/index.js +0 -4
  64. package/lib/handler/events/map_mouse_event.js +0 -19
  65. package/lib/handler/events/map_touch_event.js +1 -20
  66. package/lib/handler/events/map_wheel_event.js +1 -16
  67. package/lib/handler/events/render_event.js +0 -19
  68. package/lib/handler/handler_inertia.js +4 -37
  69. package/lib/handler/handler_manager.js +55 -171
  70. package/lib/handler/handler_util.js +1 -3
  71. package/lib/handler/keyboard.js +1 -22
  72. package/lib/handler/map_event.js +2 -11
  73. package/lib/handler/mouse/index.js +0 -4
  74. package/lib/handler/mouse/mouse_handler.js +10 -27
  75. package/lib/handler/mouse/mousepan_handler.js +0 -17
  76. package/lib/handler/mouse/mousepitch_hander.js +0 -16
  77. package/lib/handler/mouse/mouserotate_hander.js +0 -16
  78. package/lib/handler/mouse/util.js +2 -6
  79. package/lib/handler/scroll_zoom.js +43 -77
  80. package/lib/handler/shim/dblclick_zoom.js +4 -10
  81. package/lib/handler/shim/drag_pan.js +4 -13
  82. package/lib/handler/shim/drag_rotate.js +4 -11
  83. package/lib/handler/shim/touch_zoom_rotate.js +6 -18
  84. package/lib/handler/tap/single_tap_recognizer.js +8 -33
  85. package/lib/handler/tap/tap_drag_zoom.js +6 -18
  86. package/lib/handler/tap/tap_recognizer.js +2 -17
  87. package/lib/handler/tap/tap_zoom.js +0 -9
  88. package/lib/handler/touch/index.js +0 -5
  89. package/lib/handler/touch/touch_pan.js +4 -25
  90. package/lib/handler/touch/touch_pitch.js +9 -31
  91. package/lib/handler/touch/touch_rotate.js +7 -24
  92. package/lib/handler/touch/touch_zoom.js +4 -23
  93. package/lib/handler/touch/two_touch.js +18 -35
  94. package/lib/hash.js +8 -35
  95. package/lib/index.js +0 -8
  96. package/lib/map.js +14 -94
  97. package/lib/util.js +16 -34
  98. package/lib/utils/Aabb.js +10 -34
  99. package/lib/utils/dom.js +22 -64
  100. package/lib/utils/performance.js +8 -9
  101. package/lib/utils/primitives.js +13 -16
  102. package/lib/utils/task_queue.js +6 -24
  103. package/package.json +3 -3
@@ -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
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; } }
27
-
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
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; } }
27
-
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,17 @@
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
12
  var _lodash = require("lodash");
19
-
20
13
  // @ts-ignore
21
14
  // tslint:disable-next-line:no-submodule-imports
22
-
23
15
  /*
24
16
  * Adds the map's position to its page's location hash.
25
17
  * Passed as an option to the map object.
@@ -29,32 +21,26 @@ var _lodash = require("lodash");
29
21
  var Hash = /*#__PURE__*/function () {
30
22
  function Hash(hashName) {
31
23
  var _this = this;
32
-
33
24
  (0, _classCallCheck2.default)(this, Hash);
34
25
  (0, _defineProperty2.default)(this, "onHashChange", function () {
35
26
  var loc = _this.getCurrentHash();
36
-
37
27
  if (loc.length >= 3 && !loc.some(function (v) {
38
28
  return isNaN(+v);
39
29
  })) {
40
30
  var bearing = _this.map.dragRotate.isEnabled() && _this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : _this.map.getBearing();
41
-
42
31
  _this.map.jumpTo({
43
32
  center: [+loc[2], +loc[1]],
44
33
  zoom: +loc[0],
45
34
  bearing: bearing,
46
35
  pitch: +(loc[4] || 0)
47
36
  });
48
-
49
37
  return true;
50
38
  }
51
-
52
39
  return false;
53
40
  });
54
41
  (0, _defineProperty2.default)(this, "getCurrentHash", function () {
55
42
  // Get the current hash from location, stripped from its number sign
56
43
  var hash = window.location.hash.replace('#', '');
57
-
58
44
  if (_this.hashName) {
59
45
  // Split the parameter-styled hash into parts and find the value we need
60
46
  var keyval;
@@ -67,31 +53,28 @@ var Hash = /*#__PURE__*/function () {
67
53
  });
68
54
  return (keyval ? keyval[1] || '' : '').split('/');
69
55
  }
70
-
71
56
  return hash.split('/');
72
57
  });
73
58
  (0, _defineProperty2.default)(this, "updateHashUnthrottled", function () {
74
59
  var hash = _this.getHashString();
75
-
76
60
  try {
77
61
  window.history.replaceState(window.history.state, '', hash);
78
- } catch (SecurityError) {// IE11 does not allow this if the page is within an iframe created
62
+ } catch (SecurityError) {
63
+ // IE11 does not allow this if the page is within an iframe created
79
64
  // with iframe.contentWindow.document.write(...).
80
65
  // https://github.com/mapbox/mapbox-gl-js/issues/7410
81
66
  }
82
67
  });
83
- this.hashName = hashName && encodeURIComponent(hashName); // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
68
+ this.hashName = hashName && encodeURIComponent(hashName);
84
69
 
70
+ // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
85
71
  this.updateHash = (0, _lodash.throttle)(this.updateHashUnthrottled, 30 * 1000 / 100);
86
72
  }
87
-
88
73
  (0, _createClass2.default)(Hash, [{
89
74
  key: "addTo",
90
75
  value: function addTo(map) {
91
76
  this.map = map;
92
-
93
77
  _l7Utils.$window.addEventListener('hashchange', this.onHashChange, false);
94
-
95
78
  this.map.on('moveend', this.updateHash);
96
79
  return this;
97
80
  }
@@ -99,10 +82,10 @@ var Hash = /*#__PURE__*/function () {
99
82
  key: "remove",
100
83
  value: function remove() {
101
84
  _l7Utils.$window.removeEventListener('hashchange', this.onHashChange, false);
85
+ this.map.off('moveend', this.updateHash);
86
+ // clearTimeout(this.updateHash());
102
87
 
103
- this.map.off('moveend', this.updateHash); // clearTimeout(this.updateHash());
104
88
  // @ts-ignore
105
-
106
89
  delete this.map;
107
90
  return this;
108
91
  }
@@ -110,8 +93,8 @@ var Hash = /*#__PURE__*/function () {
110
93
  key: "getHashString",
111
94
  value: function getHashString(mapFeedback) {
112
95
  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
-
96
+ var zoom = Math.round(this.map.getZoom() * 100) / 100;
97
+ // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
115
98
  var precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
116
99
  var m = Math.pow(10, precision);
117
100
  var lng = Math.round(center.lng * m) / m;
@@ -119,7 +102,6 @@ var Hash = /*#__PURE__*/function () {
119
102
  var bearing = this.map.getBearing();
120
103
  var pitch = this.map.getPitch();
121
104
  var hash = '';
122
-
123
105
  if (mapFeedback) {
124
106
  // new map feedback site has some constraints that don't allow
125
107
  // us to use the same hash format as we do for the Map hash option.
@@ -127,43 +109,34 @@ var Hash = /*#__PURE__*/function () {
127
109
  } else {
128
110
  hash += "".concat(zoom, "/").concat(lat, "/").concat(lng);
129
111
  }
130
-
131
112
  if (bearing || pitch) {
132
113
  hash += "/".concat(Math.round(bearing * 10) / 10);
133
114
  }
134
-
135
115
  if (pitch) {
136
116
  hash += "/".concat(Math.round(pitch));
137
117
  }
138
-
139
118
  if (this.hashName) {
140
119
  var hashName = this.hashName;
141
120
  var found = false;
142
121
  var parts = window.location.hash.slice(1).split('&').map(function (part) {
143
122
  var key = part.split('=')[0];
144
-
145
123
  if (key === hashName) {
146
124
  found = true;
147
125
  return "".concat(key, "=").concat(hash);
148
126
  }
149
-
150
127
  return part;
151
128
  }).filter(function (a) {
152
129
  return a;
153
130
  });
154
-
155
131
  if (!found) {
156
132
  parts.push("".concat(hashName, "=").concat(hash));
157
133
  }
158
-
159
134
  return "#".concat(parts.join('&'));
160
135
  }
161
-
162
136
  return "#".concat(hash);
163
137
  }
164
138
  }]);
165
139
  return Hash;
166
140
  }();
167
-
168
141
  var _default = Hash;
169
142
  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;