@antv/l7-map 2.17.12 → 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 +4 -4
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -775
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -422
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -92
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -92
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  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 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  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 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  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 -131
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  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 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -138
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  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 -464
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -101
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  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 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -801
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -445
  116. package/lib/geo/edge_insets.js +0 -129
  117. package/lib/geo/lng_lat.js +0 -94
  118. package/lib/geo/lng_lat_bounds.js +0 -177
  119. package/lib/geo/mercator.js +0 -121
  120. package/lib/geo/point.js +0 -239
  121. package/lib/geo/simple.js +0 -123
  122. package/lib/geo/transform.js +0 -1013
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -92
  125. package/lib/handler/box_zoom.js +0 -217
  126. package/lib/handler/click_zoom.js +0 -67
  127. package/lib/handler/events/event.js +0 -23
  128. package/lib/handler/events/index.js +0 -31
  129. package/lib/handler/events/map_mouse_event.js +0 -87
  130. package/lib/handler/events/map_touch_event.js +0 -119
  131. package/lib/handler/events/map_wheel_event.js +0 -72
  132. package/lib/handler/events/render_event.js +0 -52
  133. package/lib/handler/handler_inertia.js +0 -193
  134. package/lib/handler/handler_manager.js +0 -714
  135. package/lib/handler/handler_util.js +0 -17
  136. package/lib/handler/keyboard.js +0 -172
  137. package/lib/handler/map_event.js +0 -140
  138. package/lib/handler/mouse/index.js +0 -31
  139. package/lib/handler/mouse/mouse_handler.js +0 -141
  140. package/lib/handler/mouse/mousepan_handler.js +0 -66
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -67
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -67
  143. package/lib/handler/mouse/util.js +0 -26
  144. package/lib/handler/scroll_zoom.js +0 -367
  145. package/lib/handler/shim/dblclick_zoom.js +0 -80
  146. package/lib/handler/shim/drag_pan.js +0 -105
  147. package/lib/handler/shim/drag_rotate.js +0 -88
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -139
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -131
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -124
  151. package/lib/handler/tap/tap_recognizer.js +0 -78
  152. package/lib/handler/tap/tap_zoom.js +0 -124
  153. package/lib/handler/touch/index.js +0 -39
  154. package/lib/handler/touch/touch_pan.js +0 -138
  155. package/lib/handler/touch/touch_pitch.js +0 -120
  156. package/lib/handler/touch/touch_rotate.js +0 -99
  157. package/lib/handler/touch/touch_zoom.js +0 -78
  158. package/lib/handler/touch/two_touch.js +0 -148
  159. package/lib/hash.js +0 -169
  160. package/lib/index.js +0 -57
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -135
  164. package/lib/utils/Aabb.js +0 -143
  165. package/lib/utils/dom.js +0 -233
  166. package/lib/utils/performance.js +0 -72
  167. package/lib/utils/primitives.js +0 -57
  168. package/lib/utils/task_queue.js +0 -115
package/lib/utils/Aabb.js DELETED
@@ -1,143 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _glMatrix = require("gl-matrix");
15
-
16
- 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; } } }; }
17
-
18
- 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); }
19
-
20
- 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; }
21
-
22
- var Aabb = /*#__PURE__*/function () {
23
- function Aabb(min, max) {
24
- (0, _classCallCheck2.default)(this, Aabb);
25
- this.min = min;
26
- this.max = max;
27
- this.center = _glMatrix.vec3.scale(new Float32Array(3), _glMatrix.vec3.add(new Float32Array(3), this.min, this.max), 0.5);
28
- }
29
-
30
- (0, _createClass2.default)(Aabb, [{
31
- key: "quadrant",
32
- value: function quadrant(index) {
33
- var split = [index % 2 === 0, index < 2];
34
-
35
- var qMin = _glMatrix.vec3.clone(this.min);
36
-
37
- var qMax = _glMatrix.vec3.clone(this.max);
38
-
39
- for (var axis = 0; axis < split.length; axis++) {
40
- qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];
41
- qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];
42
- } // Elevation is always constant, hence quadrant.max.z = this.max.z
43
-
44
-
45
- qMax[2] = this.max[2];
46
- return new Aabb(qMin, qMax);
47
- }
48
- }, {
49
- key: "distanceX",
50
- value: function distanceX(point) {
51
- var pointOnAabb = Math.max(Math.min(this.max[0], point[0]), this.min[0]);
52
- return pointOnAabb - point[0];
53
- }
54
- }, {
55
- key: "distanceY",
56
- value: function distanceY(point) {
57
- var pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);
58
- return pointOnAabb - point[1];
59
- } // Performs a frustum-aabb intersection test. Returns 0 if there's no intersection,
60
- // 1 if shapes are intersecting and 2 if the aabb if fully inside the frustum.
61
-
62
- }, {
63
- key: "intersects",
64
- value: function intersects(frustum) {
65
- // Execute separating axis test between two convex objects to find intersections
66
- // Each frustum plane together with 3 major axes define the separating axes
67
- // Note: test only 4 points as both min and max points have equal elevation
68
- var aabbPoints = [[this.min[0], this.min[1], 0.0, 1], [this.max[0], this.min[1], 0.0, 1], [this.max[0], this.max[1], 0.0, 1], [this.min[0], this.max[1], 0.0, 1]];
69
- var fullyInside = true;
70
-
71
- var _iterator = _createForOfIteratorHelper(frustum.planes),
72
- _step;
73
-
74
- try {
75
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
76
- var plane = _step.value;
77
- var pointsInside = 0;
78
-
79
- var _iterator3 = _createForOfIteratorHelper(aabbPoints),
80
- _step3;
81
-
82
- try {
83
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
84
- var i = _step3.value;
85
- // @ts-ignore
86
- pointsInside += _glMatrix.vec4.dot(plane, i) >= 0;
87
- }
88
- } catch (err) {
89
- _iterator3.e(err);
90
- } finally {
91
- _iterator3.f();
92
- }
93
-
94
- if (pointsInside === 0) {
95
- return 0;
96
- }
97
-
98
- if (pointsInside !== aabbPoints.length) {
99
- fullyInside = false;
100
- }
101
- }
102
- } catch (err) {
103
- _iterator.e(err);
104
- } finally {
105
- _iterator.f();
106
- }
107
-
108
- if (fullyInside) {
109
- return 2;
110
- }
111
-
112
- for (var axis = 0; axis < 3; axis++) {
113
- var projMin = Number.MAX_VALUE;
114
- var projMax = -Number.MAX_VALUE;
115
-
116
- var _iterator2 = _createForOfIteratorHelper(frustum.points),
117
- _step2;
118
-
119
- try {
120
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
121
- var p = _step2.value;
122
- var projectedPoint = p[axis] - this.min[axis];
123
- projMin = Math.min(projMin, projectedPoint);
124
- projMax = Math.max(projMax, projectedPoint);
125
- }
126
- } catch (err) {
127
- _iterator2.e(err);
128
- } finally {
129
- _iterator2.f();
130
- }
131
-
132
- if (projMax < 0 || projMin > this.max[axis] - this.min[axis]) {
133
- return 0;
134
- }
135
- }
136
-
137
- return 1;
138
- }
139
- }]);
140
- return Aabb;
141
- }();
142
-
143
- exports.default = Aabb;
package/lib/utils/dom.js DELETED
@@ -1,233 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _l7Utils = require("@antv/l7-utils");
11
-
12
- var _point = _interopRequireDefault(require("../geo/point"));
13
-
14
- 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
- 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
-
20
- var DOM = {};
21
- var _default = DOM;
22
- exports.default = _default;
23
-
24
- DOM.create = function (tagName, className, container) {
25
- var el = _l7Utils.$window.document.createElement(tagName);
26
-
27
- if (className !== undefined) {
28
- el.className = className;
29
- }
30
-
31
- if (container) {
32
- container.appendChild(el);
33
- }
34
-
35
- return el;
36
- };
37
-
38
- DOM.createNS = function (namespaceURI, tagName) {
39
- var el = _l7Utils.$window.document.createElementNS(namespaceURI, tagName);
40
-
41
- return el;
42
- };
43
-
44
- var docStyle = _l7Utils.$window.document && _l7Utils.$window.document.documentElement.style;
45
-
46
- function testProp(props) {
47
- if (!docStyle) {
48
- return props[0];
49
- }
50
-
51
- var _iterator = _createForOfIteratorHelper(props),
52
- _step;
53
-
54
- try {
55
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
56
- var i = _step.value;
57
-
58
- if (i in docStyle) {
59
- return i;
60
- }
61
- }
62
- } catch (err) {
63
- _iterator.e(err);
64
- } finally {
65
- _iterator.f();
66
- }
67
-
68
- return props[0];
69
- }
70
-
71
- var selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']);
72
- var userSelect;
73
-
74
- DOM.disableDrag = function () {
75
- if (docStyle && selectProp) {
76
- userSelect = docStyle[selectProp];
77
- docStyle[selectProp] = 'none';
78
- }
79
- };
80
-
81
- DOM.enableDrag = function () {
82
- if (docStyle && selectProp) {
83
- docStyle[selectProp] = userSelect;
84
- }
85
- };
86
-
87
- var transformProp = testProp(['transform', 'WebkitTransform']);
88
-
89
- DOM.setTransform = function (el, value) {
90
- // https://github.com/facebook/flow/issues/7754
91
- // $FlowFixMe
92
- el.style[transformProp] = value;
93
- }; // Feature detection for {passive: false} support in add/removeEventListener.
94
-
95
-
96
- var passiveSupported = false;
97
-
98
- try {
99
- // https://github.com/facebook/flow/issues/285
100
- // $FlowFixMe
101
- var options = Object.defineProperty({}, 'passive', {
102
- get: function get() {
103
- // eslint-disable-line
104
- passiveSupported = true;
105
- }
106
- }); // @ts-ignore
107
-
108
- _l7Utils.$window.addEventListener('test', options, options); // @ts-ignore
109
-
110
-
111
- _l7Utils.$window.removeEventListener('test', options, options);
112
- } catch (err) {
113
- passiveSupported = false;
114
- }
115
-
116
- DOM.addEventListener = function (target, type, callback) {
117
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
118
-
119
- if ('passive' in options && passiveSupported) {
120
- target.addEventListener(type, callback, options);
121
- } else {
122
- target.addEventListener(type, callback, options.capture);
123
- }
124
- };
125
-
126
- DOM.removeEventListener = function (target, type, callback) {
127
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
128
-
129
- if ('passive' in options && passiveSupported) {
130
- target.removeEventListener(type, callback, options);
131
- } else {
132
- target.removeEventListener(type, callback, options.capture);
133
- }
134
- }; // Suppress the next click, but only if it's immediate.
135
-
136
-
137
- var suppressClick = function suppressClick(e) {
138
- e.preventDefault();
139
- e.stopPropagation();
140
-
141
- _l7Utils.$window.removeEventListener('click', suppressClick, true);
142
- };
143
-
144
- DOM.suppressClick = function () {
145
- if (_l7Utils.isMini) {
146
- return;
147
- }
148
-
149
- _l7Utils.$window.addEventListener('click', suppressClick, true);
150
-
151
- setTimeout(function () {
152
- _l7Utils.$window.removeEventListener('click', suppressClick, true);
153
- }, 0);
154
- };
155
-
156
- DOM.mousePos = function (el, e) {
157
- // 暂时从 el 上获取 top/left, 后面需要动态获取
158
- if (!_l7Utils.isMini) {
159
- var rect = el.getBoundingClientRect();
160
- return new _point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
161
- } else {
162
- return new _point.default( // @ts-ignore
163
- e.clientX - el.left - 0, // @ts-ignore
164
- e.clientY - el.top - 0);
165
- }
166
- };
167
-
168
- DOM.touchPos = function (el, touches) {
169
- // 暂时从 el 上获取 top/left, 后面需要动态获取
170
- if (!_l7Utils.isMini) {
171
- var rect = el.getBoundingClientRect();
172
- var points = [];
173
-
174
- var _iterator2 = _createForOfIteratorHelper(touches),
175
- _step2;
176
-
177
- try {
178
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
179
- var touche = _step2.value;
180
- points.push(new _point.default(touche.clientX - rect.left - el.clientLeft, touche.clientY - rect.top - el.clientTop));
181
- }
182
- } catch (err) {
183
- _iterator2.e(err);
184
- } finally {
185
- _iterator2.f();
186
- }
187
-
188
- return points;
189
- } else {
190
- var _points = [];
191
-
192
- var _iterator3 = _createForOfIteratorHelper(touches),
193
- _step3;
194
-
195
- try {
196
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
197
- var _touche = _step3.value;
198
-
199
- _points.push(new _point.default( // @ts-ignore
200
- _touche.clientX - el.left, // @ts-ignore
201
- _touche.clientY - el.top));
202
- }
203
- } catch (err) {
204
- _iterator3.e(err);
205
- } finally {
206
- _iterator3.f();
207
- }
208
-
209
- return _points;
210
- }
211
- };
212
-
213
- DOM.mouseButton = function (e) {
214
- if (!_l7Utils.isMini) {
215
- return e.button;
216
- }
217
-
218
- if ( // @ts-ignore
219
- typeof _l7Utils.$window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey && _l7Utils.$window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
220
- // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:
221
- // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when
222
- // using Control + left click
223
- return 0;
224
- }
225
-
226
- return e.button;
227
- };
228
-
229
- DOM.remove = function (node) {
230
- if (node.parentNode) {
231
- node.parentNode.removeChild(node);
232
- }
233
- };
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PerformanceUtils = exports.PerformanceMarkers = void 0;
7
-
8
- var _l7Utils = require("@antv/l7-utils");
9
-
10
- var lastFrameTime = null;
11
- var frameTimes = [];
12
- var minFramerateTarget = 30;
13
- var frameTimeTarget = 1000 / minFramerateTarget;
14
- var performance = _l7Utils.$window.performance;
15
- var PerformanceMarkers = {
16
- create: 'create',
17
- load: 'load',
18
- fullLoad: 'fullLoad'
19
- };
20
- exports.PerformanceMarkers = PerformanceMarkers;
21
- var PerformanceUtils = {
22
- mark: function mark(marker) {
23
- performance.mark(marker);
24
- },
25
- frame: function frame(timestamp) {
26
- var currTimestamp = timestamp;
27
-
28
- if (lastFrameTime != null) {
29
- var frameTime = currTimestamp - lastFrameTime;
30
- frameTimes.push(frameTime);
31
- }
32
-
33
- lastFrameTime = currTimestamp;
34
- },
35
- clearMetrics: function clearMetrics() {
36
- lastFrameTime = null;
37
- frameTimes = [];
38
- performance.clearMeasures('loadTime');
39
- performance.clearMeasures('fullLoadTime'); // @ts-ignore
40
- // tslint:disable-next-line:forin
41
-
42
- for (var marker in PerformanceMarkers) {
43
- // @ts-ignore
44
- performance.clearMarks(PerformanceMarkers[marker]);
45
- }
46
- },
47
- getPerformanceMetrics: function getPerformanceMetrics() {
48
- var loadTime = performance.measure('loadTime', PerformanceMarkers.create, PerformanceMarkers.load // @ts-ignore
49
- ).duration;
50
- var fullLoadTime = performance.measure('fullLoadTime', PerformanceMarkers.create, PerformanceMarkers.fullLoad // @ts-ignore
51
- ).duration;
52
- var totalFrames = frameTimes.length;
53
- var avgFrameTime = frameTimes.reduce(function (prev, curr) {
54
- return prev + curr;
55
- }, 0) / totalFrames / 1000;
56
- var fps = 1 / avgFrameTime; // count frames that missed our framerate target
57
-
58
- var droppedFrames = frameTimes.filter(function (frameTime) {
59
- return frameTime > frameTimeTarget;
60
- }).reduce(function (acc, curr) {
61
- return acc + (curr - frameTimeTarget) / frameTimeTarget;
62
- }, 0);
63
- var percentDroppedFrames = droppedFrames / (totalFrames + droppedFrames) * 100;
64
- return {
65
- loadTime: loadTime,
66
- fullLoadTime: fullLoadTime,
67
- fps: fps,
68
- percentDroppedFrames: percentDroppedFrames
69
- };
70
- }
71
- };
72
- exports.PerformanceUtils = PerformanceUtils;
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _glMatrix = require("gl-matrix");
15
-
16
- var Frustum = /*#__PURE__*/function () {
17
- function Frustum(points, planes) {
18
- (0, _classCallCheck2.default)(this, Frustum);
19
- this.points = points;
20
- this.planes = planes;
21
- }
22
-
23
- (0, _createClass2.default)(Frustum, null, [{
24
- key: "fromInvProjectionMatrix",
25
- value: function fromInvProjectionMatrix(invProj, worldSize, zoom) {
26
- 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
28
-
29
- var frustumCoords = clipSpaceCorners.map(function (v) {
30
- return _glMatrix.vec4.transformMat4(new Float32Array([]), v, invProj);
31
- }).map(function (v) {
32
- return _glMatrix.vec4.scale(new Float32Array([]), v, 1.0 / v[3] / worldSize * scale);
33
- });
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
39
- [0, 4, 5] // top
40
- ];
41
- var frustumPlanes = frustumPlanePointIndices.map(function (p) {
42
- var a = _glMatrix.vec3.sub(new Float32Array(3), new Float32Array(frustumCoords[p[0]]), new Float32Array(frustumCoords[p[1]]));
43
-
44
- var b = _glMatrix.vec3.sub(new Float32Array(3), new Float32Array(frustumCoords[p[2]]), new Float32Array(frustumCoords[p[1]]));
45
-
46
- var n = _glMatrix.vec3.normalize(new Float32Array(3), _glMatrix.vec3.cross(new Float32Array(3), a, b));
47
-
48
- var d = -_glMatrix.vec3.dot(n, new Float32Array(frustumCoords[p[1]]));
49
- return n.concat(d);
50
- });
51
- return new Frustum(frustumCoords, frustumPlanes);
52
- }
53
- }]);
54
- return Frustum;
55
- }();
56
-
57
- exports.default = Frustum;
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- 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
- 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
-
20
- // can't mark opaque due to https://github.com/flowtype/flow-remove-types/pull/61
21
- var TaskQueue = /*#__PURE__*/function () {
22
- function TaskQueue() {
23
- (0, _classCallCheck2.default)(this, TaskQueue);
24
- this.queue = [];
25
- this.id = 0;
26
- this.cleared = false;
27
- this.currentlyRunning = false;
28
- }
29
-
30
- (0, _createClass2.default)(TaskQueue, [{
31
- key: "add",
32
- value: function add(callback) {
33
- var id = ++this.id;
34
- var queue = this.queue;
35
- queue.push({
36
- callback: callback,
37
- id: id,
38
- cancelled: false
39
- });
40
- return id;
41
- }
42
- }, {
43
- key: "remove",
44
- value: function remove(id) {
45
- var running = this.currentlyRunning;
46
- var queue = running ? this.queue.concat(running) : this.queue;
47
-
48
- var _iterator = _createForOfIteratorHelper(queue),
49
- _step;
50
-
51
- try {
52
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
53
- var task = _step.value;
54
-
55
- if (task.id === id) {
56
- task.cancelled = true;
57
- return;
58
- }
59
- }
60
- } catch (err) {
61
- _iterator.e(err);
62
- } finally {
63
- _iterator.f();
64
- }
65
- }
66
- }, {
67
- key: "run",
68
- value: function run() {
69
- 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.
72
-
73
- this.queue = [];
74
-
75
- var _iterator2 = _createForOfIteratorHelper(queue),
76
- _step2;
77
-
78
- try {
79
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
80
- var task = _step2.value;
81
-
82
- if (task.cancelled) {
83
- continue;
84
- }
85
-
86
- task.callback(timeStamp);
87
-
88
- if (this.cleared) {
89
- break;
90
- }
91
- }
92
- } catch (err) {
93
- _iterator2.e(err);
94
- } finally {
95
- _iterator2.f();
96
- }
97
-
98
- this.cleared = false;
99
- this.currentlyRunning = false;
100
- }
101
- }, {
102
- key: "clear",
103
- value: function clear() {
104
- if (this.currentlyRunning) {
105
- this.cleared = true;
106
- }
107
-
108
- this.queue = [];
109
- }
110
- }]);
111
- return TaskQueue;
112
- }();
113
-
114
- var _default = TaskQueue;
115
- exports.default = _default;