@antv/l7-map 2.17.11 → 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.
package/lib/util.js CHANGED
@@ -16,7 +16,6 @@ exports.prefersReducedMotion = prefersReducedMotion;
16
16
  exports.raf = void 0;
17
17
  exports.renderframe = renderframe;
18
18
  exports.wrap = wrap;
19
- var _l7Utils = require("@antv/l7-utils");
20
19
  var _unitbezier = _interopRequireDefault(require("@mapbox/unitbezier"));
21
20
  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; } } }; }
22
21
  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); }
@@ -42,14 +41,10 @@ function bezier(p1x, p1y, p2x, p2y) {
42
41
  var ease = bezier(0.25, 0.1, 0.25, 1);
43
42
  exports.ease = ease;
44
43
  function prefersReducedMotion() {
45
- // @ts-ignore
46
- if (_l7Utils.isMini || !_l7Utils.$window.matchMedia) {
47
- return false;
48
- }
49
44
  // Lazily initialize media query
50
45
  if (reducedMotionQuery == null) {
51
46
  // @ts-ignore
52
- reducedMotionQuery = _l7Utils.$window.matchMedia('(prefers-reduced-motion: reduce)');
47
+ reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
53
48
  }
54
49
  return reducedMotionQuery.matches;
55
50
  }
@@ -71,23 +66,23 @@ function pick(src, properties) {
71
66
  }
72
67
  return result;
73
68
  }
74
- var now = _l7Utils.isMini ? Date.now.bind(Date) : _l7Utils.$window.performance && _l7Utils.$window.performance.now ? _l7Utils.$window.performance.now.bind(_l7Utils.$window.performance) : Date.now.bind(Date);
69
+ var now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date);
75
70
  exports.now = now;
76
- var raf = _l7Utils.$window.requestAnimationFrame ||
71
+ var raf = window.requestAnimationFrame ||
77
72
  // @ts-ignore
78
- _l7Utils.$window.mozRequestAnimationFrame ||
73
+ window.mozRequestAnimationFrame ||
79
74
  // @ts-ignore
80
- _l7Utils.$window.webkitRequestAnimationFrame ||
75
+ window.webkitRequestAnimationFrame ||
81
76
  // @ts-ignore
82
- _l7Utils.$window.msRequestAnimationFrame;
77
+ window.msRequestAnimationFrame;
83
78
  exports.raf = raf;
84
- var _cancel = _l7Utils.$window.cancelAnimationFrame ||
79
+ var _cancel = window.cancelAnimationFrame ||
85
80
  // @ts-ignore
86
- _l7Utils.$window.mozCancelAnimationFrame ||
81
+ window.mozCancelAnimationFrame ||
87
82
  // @ts-ignore
88
- _l7Utils.$window.webkitCancelAnimationFrame ||
83
+ window.webkitCancelAnimationFrame ||
89
84
  // @ts-ignore
90
- _l7Utils.$window.msCancelAnimationFrame;
85
+ window.msCancelAnimationFrame;
91
86
  exports.cancel = _cancel;
92
87
  function renderframe(fn) {
93
88
  var frame = raf(fn);
package/lib/utils/dom.js CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _l7Utils = require("@antv/l7-utils");
9
8
  var _point = _interopRequireDefault(require("../geo/point"));
10
9
  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; } } }; }
11
10
  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); }
@@ -14,7 +13,7 @@ var DOM = {};
14
13
  var _default = DOM;
15
14
  exports.default = _default;
16
15
  DOM.create = function (tagName, className, container) {
17
- var el = _l7Utils.$window.document.createElement(tagName);
16
+ var el = window.document.createElement(tagName);
18
17
  if (className !== undefined) {
19
18
  el.className = className;
20
19
  }
@@ -24,10 +23,10 @@ DOM.create = function (tagName, className, container) {
24
23
  return el;
25
24
  };
26
25
  DOM.createNS = function (namespaceURI, tagName) {
27
- var el = _l7Utils.$window.document.createElementNS(namespaceURI, tagName);
26
+ var el = window.document.createElementNS(namespaceURI, tagName);
28
27
  return el;
29
28
  };
30
- var docStyle = _l7Utils.$window.document && _l7Utils.$window.document.documentElement.style;
29
+ var docStyle = window.document && window.document.documentElement.style;
31
30
  function testProp(props) {
32
31
  if (!docStyle) {
33
32
  return props[0];
@@ -80,9 +79,9 @@ try {
80
79
  }
81
80
  });
82
81
  // @ts-ignore
83
- _l7Utils.$window.addEventListener('test', options, options);
82
+ window.addEventListener('test', options, options);
84
83
  // @ts-ignore
85
- _l7Utils.$window.removeEventListener('test', options, options);
84
+ window.removeEventListener('test', options, options);
86
85
  } catch (err) {
87
86
  passiveSupported = false;
88
87
  }
@@ -107,81 +106,38 @@ DOM.removeEventListener = function (target, type, callback) {
107
106
  var suppressClick = function suppressClick(e) {
108
107
  e.preventDefault();
109
108
  e.stopPropagation();
110
- _l7Utils.$window.removeEventListener('click', suppressClick, true);
109
+ window.removeEventListener('click', suppressClick, true);
111
110
  };
112
111
  DOM.suppressClick = function () {
113
- if (_l7Utils.isMini) {
114
- return;
115
- }
116
- _l7Utils.$window.addEventListener('click', suppressClick, true);
112
+ window.addEventListener('click', suppressClick, true);
117
113
  setTimeout(function () {
118
- _l7Utils.$window.removeEventListener('click', suppressClick, true);
114
+ window.removeEventListener('click', suppressClick, true);
119
115
  }, 0);
120
116
  };
121
117
  DOM.mousePos = function (el, e) {
122
118
  // 暂时从 el 上获取 top/left, 后面需要动态获取
123
- if (!_l7Utils.isMini) {
124
- var rect = el.getBoundingClientRect();
125
- return new _point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
126
- } else {
127
- return new _point.default(
128
- // @ts-ignore
129
- e.clientX - el.left - 0,
130
- // @ts-ignore
131
- e.clientY - el.top - 0);
132
- }
119
+ var rect = el.getBoundingClientRect();
120
+ return new _point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
133
121
  };
134
122
  DOM.touchPos = function (el, touches) {
135
123
  // 暂时从 el 上获取 top/left, 后面需要动态获取
136
- if (!_l7Utils.isMini) {
137
- var rect = el.getBoundingClientRect();
138
- var points = [];
139
- var _iterator2 = _createForOfIteratorHelper(touches),
140
- _step2;
141
- try {
142
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
143
- var touche = _step2.value;
144
- points.push(new _point.default(touche.clientX - rect.left - el.clientLeft, touche.clientY - rect.top - el.clientTop));
145
- }
146
- } catch (err) {
147
- _iterator2.e(err);
148
- } finally {
149
- _iterator2.f();
150
- }
151
- return points;
152
- } else {
153
- var _points = [];
154
- var _iterator3 = _createForOfIteratorHelper(touches),
155
- _step3;
156
- try {
157
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
158
- var _touche = _step3.value;
159
- _points.push(new _point.default(
160
- // @ts-ignore
161
- _touche.clientX - el.left,
162
- // @ts-ignore
163
- _touche.clientY - el.top));
164
- }
165
- } catch (err) {
166
- _iterator3.e(err);
167
- } finally {
168
- _iterator3.f();
124
+ var rect = el.getBoundingClientRect();
125
+ var points = [];
126
+ var _iterator2 = _createForOfIteratorHelper(touches),
127
+ _step2;
128
+ try {
129
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
130
+ var touche = _step2.value;
131
+ points.push(new _point.default(touche.clientX - rect.left - el.clientLeft, touche.clientY - rect.top - el.clientTop));
169
132
  }
170
- return _points;
133
+ } catch (err) {
134
+ _iterator2.e(err);
135
+ } finally {
136
+ _iterator2.f();
171
137
  }
138
+ return points;
172
139
  };
173
140
  DOM.mouseButton = function (e) {
174
- if (!_l7Utils.isMini) {
175
- return e.button;
176
- }
177
- if (
178
- // @ts-ignore
179
- typeof _l7Utils.$window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey && _l7Utils.$window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
180
- // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:
181
- // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when
182
- // using Control + left click
183
- return 0;
184
- }
185
141
  return e.button;
186
142
  };
187
143
  DOM.remove = function (node) {
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PerformanceUtils = exports.PerformanceMarkers = void 0;
7
- var _l7Utils = require("@antv/l7-utils");
8
7
  var lastFrameTime = null;
9
8
  var frameTimes = [];
10
9
  var minFramerateTarget = 30;
11
10
  var frameTimeTarget = 1000 / minFramerateTarget;
12
- var performance = _l7Utils.$window.performance;
11
+ var performance = window.performance;
13
12
  var PerformanceMarkers = {
14
13
  create: 'create',
15
14
  load: 'load',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-map",
3
- "version": "2.17.11",
3
+ "version": "2.18.0",
4
4
  "description": "l7 map",
5
5
  "keywords": [],
6
6
  "author": "thinkinggis <lzx199065@gmail.com>",
@@ -40,13 +40,13 @@
40
40
  },
41
41
  "homepage": "https://github.com/antvis/L7#readme",
42
42
  "dependencies": {
43
- "@antv/l7-utils": "2.17.11",
43
+ "@antv/l7-utils": "2.18.0",
44
44
  "@babel/runtime": "^7.7.7",
45
45
  "@mapbox/point-geometry": "^0.1.0",
46
46
  "@mapbox/unitbezier": "^0.0.0",
47
47
  "eventemitter3": "^4.0.4",
48
48
  "gl-matrix": "^3.1.0",
49
- "lodash": "^4.17.15"
49
+ "lodash-es": "^4.17.21"
50
50
  },
51
- "gitHead": "eb65a689e6078899cfae55ae15232c36d3366e58"
51
+ "gitHead": "89fc0b84737ea58f9eda2fe28d70773a900939f6"
52
52
  }