@antv/l7-map 2.17.4 → 2.17.5

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 -26
  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 -38
  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
package/lib/utils/dom.js CHANGED
@@ -1,60 +1,42 @@
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 _l7Utils = require("@antv/l7-utils");
11
-
12
9
  var _point = _interopRequireDefault(require("../geo/point"));
13
-
14
10
  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; } } }; }
15
-
16
11
  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); }
17
-
18
- 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; }
19
-
12
+ 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; }
20
13
  var DOM = {};
21
14
  var _default = DOM;
22
15
  exports.default = _default;
23
-
24
16
  DOM.create = function (tagName, className, container) {
25
17
  var el = _l7Utils.$window.document.createElement(tagName);
26
-
27
18
  if (className !== undefined) {
28
19
  el.className = className;
29
20
  }
30
-
31
21
  if (container) {
32
22
  container.appendChild(el);
33
23
  }
34
-
35
24
  return el;
36
25
  };
37
-
38
26
  DOM.createNS = function (namespaceURI, tagName) {
39
27
  var el = _l7Utils.$window.document.createElementNS(namespaceURI, tagName);
40
-
41
28
  return el;
42
29
  };
43
-
44
30
  var docStyle = _l7Utils.$window.document && _l7Utils.$window.document.documentElement.style;
45
-
46
31
  function testProp(props) {
47
32
  if (!docStyle) {
48
33
  return props[0];
49
34
  }
50
-
51
35
  var _iterator = _createForOfIteratorHelper(props),
52
- _step;
53
-
36
+ _step;
54
37
  try {
55
38
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
56
39
  var i = _step.value;
57
-
58
40
  if (i in docStyle) {
59
41
  return i;
60
42
  }
@@ -64,37 +46,30 @@ function testProp(props) {
64
46
  } finally {
65
47
  _iterator.f();
66
48
  }
67
-
68
49
  return props[0];
69
50
  }
70
-
71
51
  var selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']);
72
52
  var userSelect;
73
-
74
53
  DOM.disableDrag = function () {
75
54
  if (docStyle && selectProp) {
76
55
  userSelect = docStyle[selectProp];
77
56
  docStyle[selectProp] = 'none';
78
57
  }
79
58
  };
80
-
81
59
  DOM.enableDrag = function () {
82
60
  if (docStyle && selectProp) {
83
61
  docStyle[selectProp] = userSelect;
84
62
  }
85
63
  };
86
-
87
64
  var transformProp = testProp(['transform', 'WebkitTransform']);
88
-
89
65
  DOM.setTransform = function (el, value) {
90
66
  // https://github.com/facebook/flow/issues/7754
91
67
  // $FlowFixMe
92
68
  el.style[transformProp] = value;
93
- }; // Feature detection for {passive: false} support in add/removeEventListener.
94
-
69
+ };
95
70
 
71
+ // Feature detection for {passive: false} support in add/removeEventListener.
96
72
  var passiveSupported = false;
97
-
98
73
  try {
99
74
  // https://github.com/facebook/flow/issues/285
100
75
  // $FlowFixMe
@@ -103,77 +78,66 @@ try {
103
78
  // eslint-disable-line
104
79
  passiveSupported = true;
105
80
  }
106
- }); // @ts-ignore
107
-
108
- _l7Utils.$window.addEventListener('test', options, options); // @ts-ignore
109
-
110
-
81
+ });
82
+ // @ts-ignore
83
+ _l7Utils.$window.addEventListener('test', options, options);
84
+ // @ts-ignore
111
85
  _l7Utils.$window.removeEventListener('test', options, options);
112
86
  } catch (err) {
113
87
  passiveSupported = false;
114
88
  }
115
-
116
89
  DOM.addEventListener = function (target, type, callback) {
117
90
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
118
-
119
91
  if ('passive' in options && passiveSupported) {
120
92
  target.addEventListener(type, callback, options);
121
93
  } else {
122
94
  target.addEventListener(type, callback, options.capture);
123
95
  }
124
96
  };
125
-
126
97
  DOM.removeEventListener = function (target, type, callback) {
127
98
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
128
-
129
99
  if ('passive' in options && passiveSupported) {
130
100
  target.removeEventListener(type, callback, options);
131
101
  } else {
132
102
  target.removeEventListener(type, callback, options.capture);
133
103
  }
134
- }; // Suppress the next click, but only if it's immediate.
135
-
104
+ };
136
105
 
106
+ // Suppress the next click, but only if it's immediate.
137
107
  var suppressClick = function suppressClick(e) {
138
108
  e.preventDefault();
139
109
  e.stopPropagation();
140
-
141
110
  _l7Utils.$window.removeEventListener('click', suppressClick, true);
142
111
  };
143
-
144
112
  DOM.suppressClick = function () {
145
113
  if (_l7Utils.isMini) {
146
114
  return;
147
115
  }
148
-
149
116
  _l7Utils.$window.addEventListener('click', suppressClick, true);
150
-
151
117
  setTimeout(function () {
152
118
  _l7Utils.$window.removeEventListener('click', suppressClick, true);
153
119
  }, 0);
154
120
  };
155
-
156
121
  DOM.mousePos = function (el, e) {
157
122
  // 暂时从 el 上获取 top/left, 后面需要动态获取
158
123
  if (!_l7Utils.isMini) {
159
124
  var rect = el.getBoundingClientRect();
160
125
  return new _point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
161
126
  } else {
162
- return new _point.default( // @ts-ignore
163
- e.clientX - el.left - 0, // @ts-ignore
127
+ return new _point.default(
128
+ // @ts-ignore
129
+ e.clientX - el.left - 0,
130
+ // @ts-ignore
164
131
  e.clientY - el.top - 0);
165
132
  }
166
133
  };
167
-
168
134
  DOM.touchPos = function (el, touches) {
169
135
  // 暂时从 el 上获取 top/left, 后面需要动态获取
170
136
  if (!_l7Utils.isMini) {
171
137
  var rect = el.getBoundingClientRect();
172
138
  var points = [];
173
-
174
139
  var _iterator2 = _createForOfIteratorHelper(touches),
175
- _step2;
176
-
140
+ _step2;
177
141
  try {
178
142
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
179
143
  var touche = _step2.value;
@@ -184,20 +148,18 @@ DOM.touchPos = function (el, touches) {
184
148
  } finally {
185
149
  _iterator2.f();
186
150
  }
187
-
188
151
  return points;
189
152
  } else {
190
153
  var _points = [];
191
-
192
154
  var _iterator3 = _createForOfIteratorHelper(touches),
193
- _step3;
194
-
155
+ _step3;
195
156
  try {
196
157
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
197
158
  var _touche = _step3.value;
198
-
199
- _points.push(new _point.default( // @ts-ignore
200
- _touche.clientX - el.left, // @ts-ignore
159
+ _points.push(new _point.default(
160
+ // @ts-ignore
161
+ _touche.clientX - el.left,
162
+ // @ts-ignore
201
163
  _touche.clientY - el.top));
202
164
  }
203
165
  } catch (err) {
@@ -205,27 +167,23 @@ DOM.touchPos = function (el, touches) {
205
167
  } finally {
206
168
  _iterator3.f();
207
169
  }
208
-
209
170
  return _points;
210
171
  }
211
172
  };
212
-
213
173
  DOM.mouseButton = function (e) {
214
174
  if (!_l7Utils.isMini) {
215
175
  return e.button;
216
176
  }
217
-
218
- if ( // @ts-ignore
177
+ if (
178
+ // @ts-ignore
219
179
  typeof _l7Utils.$window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey && _l7Utils.$window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
220
180
  // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:
221
181
  // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when
222
182
  // using Control + left click
223
183
  return 0;
224
184
  }
225
-
226
185
  return e.button;
227
186
  };
228
-
229
187
  DOM.remove = function (node) {
230
188
  if (node.parentNode) {
231
189
  node.parentNode.removeChild(node);
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PerformanceUtils = exports.PerformanceMarkers = void 0;
7
-
8
7
  var _l7Utils = require("@antv/l7-utils");
9
-
10
8
  var lastFrameTime = null;
11
9
  var frameTimes = [];
12
10
  var minFramerateTarget = 30;
@@ -24,37 +22,38 @@ var PerformanceUtils = {
24
22
  },
25
23
  frame: function frame(timestamp) {
26
24
  var currTimestamp = timestamp;
27
-
28
25
  if (lastFrameTime != null) {
29
26
  var frameTime = currTimestamp - lastFrameTime;
30
27
  frameTimes.push(frameTime);
31
28
  }
32
-
33
29
  lastFrameTime = currTimestamp;
34
30
  },
35
31
  clearMetrics: function clearMetrics() {
36
32
  lastFrameTime = null;
37
33
  frameTimes = [];
38
34
  performance.clearMeasures('loadTime');
39
- performance.clearMeasures('fullLoadTime'); // @ts-ignore
35
+ performance.clearMeasures('fullLoadTime');
36
+ // @ts-ignore
40
37
  // tslint:disable-next-line:forin
41
-
42
38
  for (var marker in PerformanceMarkers) {
43
39
  // @ts-ignore
44
40
  performance.clearMarks(PerformanceMarkers[marker]);
45
41
  }
46
42
  },
47
43
  getPerformanceMetrics: function getPerformanceMetrics() {
48
- var loadTime = performance.measure('loadTime', PerformanceMarkers.create, PerformanceMarkers.load // @ts-ignore
44
+ var loadTime = performance.measure('loadTime', PerformanceMarkers.create, PerformanceMarkers.load
45
+ // @ts-ignore
49
46
  ).duration;
50
- var fullLoadTime = performance.measure('fullLoadTime', PerformanceMarkers.create, PerformanceMarkers.fullLoad // @ts-ignore
47
+ var fullLoadTime = performance.measure('fullLoadTime', PerformanceMarkers.create, PerformanceMarkers.fullLoad
48
+ // @ts-ignore
51
49
  ).duration;
52
50
  var totalFrames = frameTimes.length;
53
51
  var avgFrameTime = frameTimes.reduce(function (prev, curr) {
54
52
  return prev + curr;
55
53
  }, 0) / totalFrames / 1000;
56
- var fps = 1 / avgFrameTime; // count frames that missed our framerate target
54
+ var fps = 1 / avgFrameTime;
57
55
 
56
+ // count frames that missed our framerate target
58
57
  var droppedFrames = frameTimes.filter(function (frameTime) {
59
58
  return frameTime > frameTimeTarget;
60
59
  }).reduce(function (acc, curr) {
@@ -1,50 +1,48 @@
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 _glMatrix = require("gl-matrix");
15
-
16
11
  var Frustum = /*#__PURE__*/function () {
17
12
  function Frustum(points, planes) {
18
13
  (0, _classCallCheck2.default)(this, Frustum);
19
14
  this.points = points;
20
15
  this.planes = planes;
21
16
  }
22
-
23
17
  (0, _createClass2.default)(Frustum, null, [{
24
18
  key: "fromInvProjectionMatrix",
25
19
  value: function fromInvProjectionMatrix(invProj, worldSize, zoom) {
26
20
  var clipSpaceCorners = [[-1, 1, -1, 1], [1, 1, -1, 1], [1, -1, -1, 1], [-1, -1, -1, 1], [-1, 1, 1, 1], [1, 1, 1, 1], [1, -1, 1, 1], [-1, -1, 1, 1]];
27
- var scale = Math.pow(2, zoom); // Transform frustum corner points from clip space to tile space
21
+ var scale = Math.pow(2, zoom);
28
22
 
23
+ // Transform frustum corner points from clip space to tile space
29
24
  var frustumCoords = clipSpaceCorners.map(function (v) {
30
25
  return _glMatrix.vec4.transformMat4(new Float32Array([]), v, invProj);
31
26
  }).map(function (v) {
32
27
  return _glMatrix.vec4.scale(new Float32Array([]), v, 1.0 / v[3] / worldSize * scale);
33
28
  });
34
- var frustumPlanePointIndices = [[0, 1, 2], // near
35
- [6, 5, 4], // far
36
- [0, 3, 7], // left
37
- [2, 1, 5], // right
38
- [3, 2, 6], // bottom
29
+ var frustumPlanePointIndices = [[0, 1, 2],
30
+ // near
31
+ [6, 5, 4],
32
+ // far
33
+ [0, 3, 7],
34
+ // left
35
+ [2, 1, 5],
36
+ // right
37
+ [3, 2, 6],
38
+ // bottom
39
39
  [0, 4, 5] // top
40
40
  ];
41
+
41
42
  var frustumPlanes = frustumPlanePointIndices.map(function (p) {
42
43
  var a = _glMatrix.vec3.sub(new Float32Array(3), new Float32Array(frustumCoords[p[0]]), new Float32Array(frustumCoords[p[1]]));
43
-
44
44
  var b = _glMatrix.vec3.sub(new Float32Array(3), new Float32Array(frustumCoords[p[2]]), new Float32Array(frustumCoords[p[1]]));
45
-
46
45
  var n = _glMatrix.vec3.normalize(new Float32Array(3), _glMatrix.vec3.cross(new Float32Array(3), a, b));
47
-
48
46
  var d = -_glMatrix.vec3.dot(n, new Float32Array(frustumCoords[p[1]]));
49
47
  return n.concat(d);
50
48
  });
@@ -53,5 +51,4 @@ var Frustum = /*#__PURE__*/function () {
53
51
  }]);
54
52
  return Frustum;
55
53
  }();
56
-
57
54
  exports.default = Frustum;
@@ -1,22 +1,15 @@
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
  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; } } }; }
15
-
16
11
  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); }
17
-
18
- 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; }
19
-
12
+ 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; }
20
13
  // can't mark opaque due to https://github.com/flowtype/flow-remove-types/pull/61
21
14
  var TaskQueue = /*#__PURE__*/function () {
22
15
  function TaskQueue() {
@@ -26,7 +19,6 @@ var TaskQueue = /*#__PURE__*/function () {
26
19
  this.cleared = false;
27
20
  this.currentlyRunning = false;
28
21
  }
29
-
30
22
  (0, _createClass2.default)(TaskQueue, [{
31
23
  key: "add",
32
24
  value: function add(callback) {
@@ -44,14 +36,11 @@ var TaskQueue = /*#__PURE__*/function () {
44
36
  value: function remove(id) {
45
37
  var running = this.currentlyRunning;
46
38
  var queue = running ? this.queue.concat(running) : this.queue;
47
-
48
39
  var _iterator = _createForOfIteratorHelper(queue),
49
- _step;
50
-
40
+ _step;
51
41
  try {
52
42
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
53
43
  var task = _step.value;
54
-
55
44
  if (task.id === id) {
56
45
  task.cancelled = true;
57
46
  return;
@@ -67,24 +56,20 @@ var TaskQueue = /*#__PURE__*/function () {
67
56
  key: "run",
68
57
  value: function run() {
69
58
  var timeStamp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
70
- var queue = this.currentlyRunning = this.queue; // Tasks queued by callbacks in the current queue should be executed
71
- // on the next run, not the current run.
59
+ var queue = this.currentlyRunning = this.queue;
72
60
 
61
+ // Tasks queued by callbacks in the current queue should be executed
62
+ // on the next run, not the current run.
73
63
  this.queue = [];
74
-
75
64
  var _iterator2 = _createForOfIteratorHelper(queue),
76
- _step2;
77
-
65
+ _step2;
78
66
  try {
79
67
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
80
68
  var task = _step2.value;
81
-
82
69
  if (task.cancelled) {
83
70
  continue;
84
71
  }
85
-
86
72
  task.callback(timeStamp);
87
-
88
73
  if (this.cleared) {
89
74
  break;
90
75
  }
@@ -94,7 +79,6 @@ var TaskQueue = /*#__PURE__*/function () {
94
79
  } finally {
95
80
  _iterator2.f();
96
81
  }
97
-
98
82
  this.cleared = false;
99
83
  this.currentlyRunning = false;
100
84
  }
@@ -104,12 +88,10 @@ var TaskQueue = /*#__PURE__*/function () {
104
88
  if (this.currentlyRunning) {
105
89
  this.cleared = true;
106
90
  }
107
-
108
91
  this.queue = [];
109
92
  }
110
93
  }]);
111
94
  return TaskQueue;
112
95
  }();
113
-
114
96
  var _default = TaskQueue;
115
97
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-map",
3
- "version": "2.17.4",
3
+ "version": "2.17.5",
4
4
  "description": "l7 map",
5
5
  "keywords": [],
6
6
  "author": "thinkinggis <lzx199065@gmail.com>",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "homepage": "https://github.com/antvis/L7#readme",
42
42
  "dependencies": {
43
- "@antv/l7-utils": "^2.17.4",
43
+ "@antv/l7-utils": "2.17.5",
44
44
  "@babel/runtime": "^7.7.7",
45
45
  "@mapbox/point-geometry": "^0.1.0",
46
46
  "@mapbox/unitbezier": "^0.0.0",
@@ -48,5 +48,5 @@
48
48
  "gl-matrix": "^3.1.0",
49
49
  "lodash": "^4.17.15"
50
50
  },
51
- "gitHead": "f6a09dc02ed0fc7a7f5dc44b231105f43b26f67b"
51
+ "gitHead": "9da38170fe5ac1bec6a92b5e75f23ecf573c6d9c"
52
52
  }