@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/map.js DELETED
@@ -1,464 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
- import { $window, DOM, isMini } from '@antv/l7-utils';
15
- import { merge } from 'lodash';
16
- import Camera from "./camera";
17
-
18
- function loadStyles(css, doc) {
19
- var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
20
- var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
21
-
22
- if (isMiniAli || isWeChatMiniProgram) {
23
- return;
24
- }
25
-
26
- if (!doc) doc = document;
27
-
28
- if (!doc) {
29
- return;
30
- }
31
-
32
- var head = doc.head || doc.getElementsByTagName('head')[0];
33
-
34
- if (!head) {
35
- head = doc.createElement('head');
36
- var body = doc.body || doc.getElementsByTagName('body')[0];
37
-
38
- if (body) {
39
- body.parentNode.insertBefore(head, body);
40
- } else {
41
- doc.documentElement.appendChild(head);
42
- }
43
- }
44
-
45
- var style = doc.createElement('style');
46
- style.type = 'text/css';
47
-
48
- if (style.styleSheet) {
49
- style.styleSheet.cssText = css;
50
- } else {
51
- style.appendChild(doc.createTextNode(css));
52
- }
53
-
54
- head.appendChild(style);
55
- return style;
56
- }
57
-
58
- loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n");
59
- import LngLat from "./geo/lng_lat";
60
- import LngLatBounds from "./geo/lng_lat_bounds"; // @ts-ignore
61
-
62
- import Point from "./geo/point";
63
- import HandlerManager from "./handler/handler_manager";
64
- import Hash from "./hash";
65
- import { renderframe } from "./util";
66
- import { PerformanceUtils } from "./utils/performance";
67
- import TaskQueue from "./utils/task_queue";
68
- var defaultMinZoom = -2;
69
- var defaultMaxZoom = 22; // the default values, but also the valid range
70
-
71
- var defaultMinPitch = 0;
72
- var defaultMaxPitch = 60;
73
- var DefaultOptions = {
74
- hash: false,
75
- zoom: -1,
76
- center: [112, 32],
77
- pitch: 0,
78
- bearing: 0,
79
- interactive: true,
80
- minZoom: defaultMinZoom,
81
- maxZoom: defaultMaxZoom,
82
- minPitch: defaultMinPitch,
83
- maxPitch: defaultMaxPitch,
84
- scrollZoom: true,
85
- boxZoom: true,
86
- dragRotate: true,
87
- dragPan: true,
88
- keyboard: true,
89
- doubleClickZoom: true,
90
- touchZoomRotate: true,
91
- touchPitch: true,
92
- bearingSnap: 7,
93
- clickTolerance: 3,
94
- pitchWithRotate: true,
95
- trackResize: true,
96
- renderWorldCopies: true,
97
- pitchEnabled: true,
98
- rotateEnabled: true
99
- };
100
- export var Map = /*#__PURE__*/function (_Camera) {
101
- _inherits(Map, _Camera);
102
-
103
- var _super = _createSuper(Map);
104
-
105
- function Map(options) {
106
- var _this;
107
-
108
- _classCallCheck(this, Map);
109
-
110
- _this = _super.call(this, merge({}, DefaultOptions, options));
111
-
112
- _defineProperty(_assertThisInitialized(_this), "renderTaskQueue", new TaskQueue());
113
-
114
- _defineProperty(_assertThisInitialized(_this), "trackResize", true);
115
-
116
- _defineProperty(_assertThisInitialized(_this), "onWindowOnline", function () {
117
- _this.update();
118
- });
119
-
120
- _defineProperty(_assertThisInitialized(_this), "onWindowResize", function (event) {
121
- if (_this.trackResize) {
122
- _this.resize({
123
- originalEvent: event
124
- }).update();
125
- }
126
- });
127
-
128
- if (isMini) {
129
- _this.initMiniContainer();
130
- } else {
131
- _this.initContainer();
132
- }
133
-
134
- _this.resize();
135
-
136
- _this.handlers = new HandlerManager(_assertThisInitialized(_this), _this.options);
137
-
138
- if (typeof window !== 'undefined') {
139
- window.addEventListener('online', _this.onWindowOnline, false);
140
- window.addEventListener('resize', _this.onWindowResize, false);
141
- window.addEventListener('orientationchange', _this.onWindowResize, false);
142
- }
143
-
144
- if (!isMini) {
145
- var hashName = typeof options.hash === 'string' && options.hash || undefined;
146
-
147
- if (options.hash) {
148
- _this.hash = new Hash(hashName).addTo(_assertThisInitialized(_this));
149
- }
150
- } // don't set position from options if set through hash
151
-
152
-
153
- if (!_this.hash || !_this.hash.onHashChange()) {
154
- _this.jumpTo({
155
- center: options.center,
156
- zoom: options.zoom,
157
- bearing: options.bearing,
158
- pitch: options.pitch
159
- });
160
-
161
- if (options.bounds) {
162
- _this.resize();
163
-
164
- _this.fitBounds(options.bounds, merge({}, options.fitBoundsOptions, {
165
- duration: 0
166
- }));
167
- }
168
- }
169
-
170
- return _this;
171
- }
172
-
173
- _createClass(Map, [{
174
- key: "resize",
175
- value: function resize(eventData) {
176
- var _this$containerDimens = this.containerDimensions(),
177
- _this$containerDimens2 = _slicedToArray(_this$containerDimens, 2),
178
- width = _this$containerDimens2[0],
179
- height = _this$containerDimens2[1];
180
-
181
- this.transform.resize(width, height); // 小程序环境不需要执行后续动作
182
-
183
- if (isMini) {
184
- return this;
185
- }
186
-
187
- var fireMoving = !this.moving;
188
-
189
- if (fireMoving) {
190
- this.stop();
191
- this.emit('movestart', new $window.Event('movestart', eventData));
192
- this.emit('move', new $window.Event('move', eventData));
193
- }
194
-
195
- this.emit('resize', new $window.Event('resize', eventData));
196
-
197
- if (fireMoving) {
198
- this.emit('moveend', new $window.Event('moveend', eventData));
199
- }
200
-
201
- return this;
202
- }
203
- }, {
204
- key: "getContainer",
205
- value: function getContainer() {
206
- return this.container;
207
- }
208
- }, {
209
- key: "getCanvas",
210
- value: function getCanvas() {
211
- return this.canvas;
212
- }
213
- }, {
214
- key: "getCanvasContainer",
215
- value: function getCanvasContainer() {
216
- return this.canvasContainer;
217
- }
218
- }, {
219
- key: "project",
220
- value: function project(lngLat) {
221
- return this.transform.locationPoint(LngLat.convert(lngLat));
222
- }
223
- }, {
224
- key: "unproject",
225
- value: function unproject(point) {
226
- return this.transform.pointLocation(Point.convert(point));
227
- }
228
- }, {
229
- key: "getBounds",
230
- value: function getBounds() {
231
- return this.transform.getBounds();
232
- }
233
- }, {
234
- key: "getMaxBounds",
235
- value: function getMaxBounds() {
236
- return this.transform.getMaxBounds();
237
- }
238
- }, {
239
- key: "setMaxBounds",
240
- value: function setMaxBounds(bounds) {
241
- this.transform.setMaxBounds(LngLatBounds.convert(bounds));
242
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
243
-
244
- }, {
245
- key: "setStyle",
246
- value: function setStyle(style) {
247
- return;
248
- }
249
- }, {
250
- key: "setMinZoom",
251
- value: function setMinZoom(minZoom) {
252
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
253
-
254
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
255
- this.transform.minZoom = minZoom;
256
-
257
- if (this.getZoom() < minZoom) {
258
- this.setZoom(minZoom);
259
- }
260
-
261
- return this;
262
- } else {
263
- throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
264
- }
265
- }
266
- }, {
267
- key: "getMinZoom",
268
- value: function getMinZoom() {
269
- return this.transform.minZoom;
270
- }
271
- }, {
272
- key: "setMaxZoom",
273
- value: function setMaxZoom(maxZoom) {
274
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
275
-
276
- if (maxZoom >= this.transform.minZoom) {
277
- this.transform.maxZoom = maxZoom;
278
-
279
- if (this.getZoom() > maxZoom) {
280
- this.setZoom(maxZoom);
281
- }
282
-
283
- return this;
284
- } else {
285
- throw new Error('maxZoom must be greater than the current minZoom');
286
- }
287
- }
288
- }, {
289
- key: "getMaxZoom",
290
- value: function getMaxZoom() {
291
- return this.transform.maxZoom;
292
- }
293
- }, {
294
- key: "setMinPitch",
295
- value: function setMinPitch(minPitch) {
296
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
297
-
298
- if (minPitch < defaultMinPitch) {
299
- throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
300
- }
301
-
302
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
303
- this.transform.minPitch = minPitch;
304
-
305
- if (this.getPitch() < minPitch) {
306
- this.setPitch(minPitch);
307
- }
308
-
309
- return this;
310
- } else {
311
- throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
312
- }
313
- }
314
- }, {
315
- key: "getMinPitch",
316
- value: function getMinPitch() {
317
- return this.transform.minPitch;
318
- }
319
- }, {
320
- key: "setMaxPitch",
321
- value: function setMaxPitch(maxPitch) {
322
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
323
-
324
- if (maxPitch > defaultMaxPitch) {
325
- throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
326
- }
327
-
328
- if (maxPitch >= this.transform.minPitch) {
329
- this.transform.maxPitch = maxPitch;
330
-
331
- if (this.getPitch() > maxPitch) {
332
- this.setPitch(maxPitch);
333
- }
334
-
335
- return this;
336
- } else {
337
- throw new Error('maxPitch must be greater than the current minPitch');
338
- }
339
- }
340
- }, {
341
- key: "getMaxPitch",
342
- value: function getMaxPitch() {
343
- return this.transform.maxPitch;
344
- }
345
- }, {
346
- key: "getRenderWorldCopies",
347
- value: function getRenderWorldCopies() {
348
- return this.transform.renderWorldCopies;
349
- }
350
- }, {
351
- key: "setRenderWorldCopies",
352
- value: function setRenderWorldCopies(renderWorldCopies) {
353
- this.transform.renderWorldCopies = !!renderWorldCopies;
354
- }
355
- }, {
356
- key: "remove",
357
- value: function remove() {
358
- this.container.removeChild(this.canvasContainer); // @ts-ignore
359
-
360
- this.canvasContainer = null;
361
-
362
- if (this.frame) {
363
- this.frame.cancel();
364
- this.frame = null;
365
- }
366
-
367
- this.renderTaskQueue.clear();
368
- }
369
- }, {
370
- key: "requestRenderFrame",
371
- value: function requestRenderFrame(cb) {
372
- this.update();
373
- return this.renderTaskQueue.add(cb);
374
- }
375
- }, {
376
- key: "cancelRenderFrame",
377
- value: function cancelRenderFrame(id) {
378
- return this.renderTaskQueue.remove(id);
379
- }
380
- }, {
381
- key: "triggerRepaint",
382
- value: function triggerRepaint() {
383
- var _this2 = this;
384
-
385
- if (!this.frame) {
386
- this.frame = renderframe(function (paintStartTimeStamp) {
387
- PerformanceUtils.frame(paintStartTimeStamp);
388
- _this2.frame = null;
389
-
390
- _this2.update(paintStartTimeStamp);
391
- });
392
- }
393
- }
394
- }, {
395
- key: "update",
396
- value: function update(time) {
397
- var _this3 = this;
398
-
399
- if (!this.frame) {
400
- this.frame = renderframe(function (paintStartTimeStamp) {
401
- PerformanceUtils.frame(paintStartTimeStamp);
402
- _this3.frame = null;
403
-
404
- _this3.renderTaskQueue.run(time);
405
- });
406
- }
407
- }
408
- }, {
409
- key: "initContainer",
410
- value: function initContainer() {
411
- if (typeof this.options.container === 'string') {
412
- this.container = window.document.getElementById(this.options.container);
413
-
414
- if (!this.container) {
415
- throw new Error("Container '".concat(this.options.container, "' not found."));
416
- }
417
- } else if (this.options.container instanceof HTMLElement) {
418
- this.container = this.options.container;
419
- } else {
420
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
421
- }
422
-
423
- var container = this.container;
424
- container.classList.add('l7-map');
425
- var canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
426
-
427
- if (this.options.interactive) {
428
- canvasContainer.classList.add('l7-interactive');
429
- }
430
- }
431
- /**
432
- * 小程序环境构建容器
433
- */
434
-
435
- }, {
436
- key: "initMiniContainer",
437
- value: function initMiniContainer() {
438
- this.container = this.options.canvas;
439
- this.canvasContainer = this.container;
440
- }
441
- }, {
442
- key: "containerDimensions",
443
- value: function containerDimensions() {
444
- var width = 0;
445
- var height = 0;
446
-
447
- if (this.container) {
448
- if (isMini) {
449
- width = this.container.width / $window.devicePixelRatio;
450
- height = this.container.height / $window.devicePixelRatio;
451
- } else {
452
- width = this.container.clientWidth;
453
- height = this.container.clientHeight;
454
- width = width === 0 ? 400 : width;
455
- height = height === 0 ? 300 : height;
456
- }
457
- }
458
-
459
- return [width, height];
460
- }
461
- }]);
462
-
463
- return Map;
464
- }(Camera);
package/es/util.d.ts DELETED
@@ -1,25 +0,0 @@
1
- export interface ICancelable {
2
- cancel: () => void;
3
- }
4
- export declare function wrap(n: number, min: number, max: number): number;
5
- export declare function clamp(n: number, min: number, max: number): number;
6
- export declare function interpolate(a: number, b: number, t: number): number;
7
- export declare function bezier(p1x: number, p1y: number, p2x: number, p2y: number): (t: number) => number;
8
- export declare const ease: (t: number) => number;
9
- export declare function prefersReducedMotion(): boolean;
10
- export declare function pick(src: {
11
- [key: string]: any;
12
- }, properties: string[]): {
13
- [key: string]: any;
14
- };
15
- export declare const now: any;
16
- export declare const raf: any;
17
- export declare const cancel: any;
18
- export declare function renderframe(fn: (paintStartTimestamp: number) => void): ICancelable;
19
- export declare function extend(dest: {
20
- [key: string]: any;
21
- }, ...sources: Array<Partial<{
22
- [key: string]: any;
23
- }>>): {
24
- [key: string]: any;
25
- };
package/es/util.js DELETED
@@ -1,101 +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 UnitBezier from '@mapbox/unitbezier';
10
- var reducedMotionQuery;
11
- export function wrap(n, min, max) {
12
- var d = max - min;
13
- var w = ((n - min) % d + d) % d + min;
14
- return w === min ? max : w;
15
- }
16
- export function clamp(n, min, max) {
17
- return Math.min(max, Math.max(min, n));
18
- }
19
- export function interpolate(a, b, t) {
20
- return a * (1 - t) + b * t;
21
- }
22
- export function bezier(p1x, p1y, p2x, p2y) {
23
- var bez = new UnitBezier(p1x, p1y, p2x, p2y);
24
- return function (t) {
25
- return bez.solve(t);
26
- };
27
- }
28
- export var ease = bezier(0.25, 0.1, 0.25, 1);
29
- export function prefersReducedMotion() {
30
- // @ts-ignore
31
- if (isMini || !$window.matchMedia) {
32
- return false;
33
- } // Lazily initialize media query
34
-
35
-
36
- if (reducedMotionQuery == null) {
37
- // @ts-ignore
38
- reducedMotionQuery = $window.matchMedia('(prefers-reduced-motion: reduce)');
39
- }
40
-
41
- return reducedMotionQuery.matches;
42
- }
43
- export function pick(src, properties) {
44
- var result = {};
45
-
46
- var _iterator = _createForOfIteratorHelper(properties),
47
- _step;
48
-
49
- try {
50
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
51
- var name = _step.value;
52
-
53
- if (name in src) {
54
- result[name] = src[name];
55
- }
56
- }
57
- } catch (err) {
58
- _iterator.e(err);
59
- } finally {
60
- _iterator.f();
61
- }
62
-
63
- return result;
64
- }
65
- export var now = isMini ? Date.now.bind(Date) : $window.performance && $window.performance.now ? $window.performance.now.bind($window.performance) : Date.now.bind(Date);
66
- export var raf = $window.requestAnimationFrame || // @ts-ignore
67
- $window.mozRequestAnimationFrame || // @ts-ignore
68
- $window.webkitRequestAnimationFrame || // @ts-ignore
69
- $window.msRequestAnimationFrame;
70
-
71
- var _cancel = $window.cancelAnimationFrame || // @ts-ignore
72
- $window.mozCancelAnimationFrame || // @ts-ignore
73
- $window.webkitCancelAnimationFrame || // @ts-ignore
74
- $window.msCancelAnimationFrame;
75
-
76
- export { _cancel as cancel };
77
- export function renderframe(fn) {
78
- var frame = raf(fn);
79
- return {
80
- cancel: function cancel() {
81
- return _cancel(frame);
82
- }
83
- };
84
- }
85
- export function extend(dest) {
86
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
87
- sources[_key - 1] = arguments[_key];
88
- }
89
-
90
- for (var _i = 0, _sources = sources; _i < _sources.length; _i++) {
91
- var src = _sources[_i];
92
-
93
- for (var k in src) {
94
- if (src[k] !== undefined) {
95
- dest[k] = src[k];
96
- }
97
- }
98
- }
99
-
100
- return dest;
101
- }
@@ -1,12 +0,0 @@
1
- import { vec3 } from 'gl-matrix';
2
- import Frustum from './primitives';
3
- export default class Aabb {
4
- min: vec3;
5
- max: vec3;
6
- center: vec3;
7
- constructor(min: vec3, max: vec3);
8
- quadrant(index: number): Aabb;
9
- distanceX(point: number[]): number;
10
- distanceY(point: number[]): number;
11
- intersects(frustum: Frustum): number;
12
- }