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