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