@antv/l7-component 2.9.20 → 2.9.22

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 (53) hide show
  1. package/es/control/BaseControl.js +5 -26
  2. package/es/control/layer.js +13 -28
  3. package/es/control/logo.js +3 -4
  4. package/es/control/scale.js +6 -11
  5. package/es/control/zoom.js +3 -12
  6. package/es/css/l7.css +502 -0
  7. package/es/images/layers.png +0 -0
  8. package/es/images/layers.svg +1 -0
  9. package/es/images/logo.png +0 -0
  10. package/es/index.js +10 -10
  11. package/es/interface.js +1 -2
  12. package/es/marker-layer.js +27 -27
  13. package/es/marker.js +21 -27
  14. package/es/popup.js +16 -34
  15. package/es/utils/anchor.js +1 -2
  16. package/lib/control/BaseControl.js +100 -163
  17. package/lib/control/layer.js +248 -347
  18. package/lib/control/logo.js +52 -77
  19. package/lib/control/scale.js +112 -165
  20. package/lib/control/zoom.js +95 -143
  21. package/lib/css/l7.css +502 -0
  22. package/lib/images/layers.png +0 -0
  23. package/lib/images/layers.svg +1 -0
  24. package/lib/images/logo.png +0 -0
  25. package/lib/index.js +53 -135
  26. package/lib/interface.js +17 -2
  27. package/lib/marker-layer.js +224 -330
  28. package/lib/marker.js +271 -404
  29. package/lib/popup.js +201 -309
  30. package/lib/utils/anchor.js +54 -37
  31. package/package.json +9 -9
  32. package/es/control/BaseControl.js.map +0 -1
  33. package/es/control/layer.js.map +0 -1
  34. package/es/control/logo.js.map +0 -1
  35. package/es/control/scale.js.map +0 -1
  36. package/es/control/zoom.js.map +0 -1
  37. package/es/index.js.map +0 -1
  38. package/es/interface.js.map +0 -1
  39. package/es/marker-layer.js.map +0 -1
  40. package/es/marker.js.map +0 -1
  41. package/es/popup.js.map +0 -1
  42. package/es/utils/anchor.js.map +0 -1
  43. package/lib/control/BaseControl.js.map +0 -1
  44. package/lib/control/layer.js.map +0 -1
  45. package/lib/control/logo.js.map +0 -1
  46. package/lib/control/scale.js.map +0 -1
  47. package/lib/control/zoom.js.map +0 -1
  48. package/lib/index.js.map +0 -1
  49. package/lib/interface.js.map +0 -1
  50. package/lib/marker-layer.js.map +0 -1
  51. package/lib/marker.js.map +0 -1
  52. package/lib/popup.js.map +0 -1
  53. package/lib/utils/anchor.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -5,11 +6,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _merge from "lodash/merge";
9
-
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
-
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
9
 
14
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); }; }
15
11
 
@@ -18,10 +14,13 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
18
14
  import { TYPES } from '@antv/l7-core';
19
15
  import { bindAll, boundsContains, DOM, padBounds, Satistics } from '@antv/l7-utils';
20
16
  import { EventEmitter } from 'eventemitter3';
17
+ import { merge } from 'lodash'; // @ts-ignore
18
+ // tslint:disable-next-line:no-submodule-imports
19
+
21
20
  import Supercluster from 'supercluster/dist/supercluster';
22
- import Marker from './marker';
21
+ import Marker from "./marker";
23
22
 
24
- var MarkerLayer = function (_EventEmitter) {
23
+ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
25
24
  _inherits(MarkerLayer, _EventEmitter);
26
25
 
27
26
  var _super = _createSuper(MarkerLayer);
@@ -37,23 +36,11 @@ var MarkerLayer = function (_EventEmitter) {
37
36
 
38
37
  _defineProperty(_assertThisInitialized(_this), "markers", []);
39
38
 
40
- _defineProperty(_assertThisInitialized(_this), "markerLayerOption", void 0);
41
-
42
- _defineProperty(_assertThisInitialized(_this), "clusterIndex", void 0);
43
-
44
39
  _defineProperty(_assertThisInitialized(_this), "points", []);
45
40
 
46
41
  _defineProperty(_assertThisInitialized(_this), "clusterMarkers", []);
47
42
 
48
- _defineProperty(_assertThisInitialized(_this), "mapsService", void 0);
49
-
50
- _defineProperty(_assertThisInitialized(_this), "scene", void 0);
51
-
52
- _defineProperty(_assertThisInitialized(_this), "zoom", void 0);
53
-
54
- _defineProperty(_assertThisInitialized(_this), "bbox", void 0);
55
-
56
- _this.markerLayerOption = _merge(_this.getDefault(), option);
43
+ _this.markerLayerOption = merge(_this.getDefault(), option);
57
44
  bindAll(['update'], _assertThisInitialized(_this));
58
45
  _this.zoom = ((_this$markerLayerOpti = _this.markerLayerOption.clusterOption) === null || _this$markerLayerOpti === void 0 ? void 0 : _this$markerLayerOpti.zoom) || -99;
59
46
  return _this;
@@ -77,14 +64,17 @@ var MarkerLayer = function (_EventEmitter) {
77
64
  }, {
78
65
  key: "addTo",
79
66
  value: function addTo(scene) {
67
+ // this.remove();
80
68
  this.scene = scene;
81
69
  this.mapsService = scene.get(TYPES.IMapService);
82
70
 
83
71
  if (this.markerLayerOption.cluster) {
84
72
  this.initCluster();
85
- this.update();
86
- this.mapsService.on('camerachange', this.update);
87
- this.mapsService.on('viewchange', this.update);
73
+ this.update(); // 地图视野变化时,重新计算视野内的聚合点。
74
+
75
+ this.mapsService.on('camerachange', this.update); // amap1.x 更新事件
76
+
77
+ this.mapsService.on('viewchange', this.update); // amap2.0 更新事件
88
78
  }
89
79
 
90
80
  this.addMarkers();
@@ -99,6 +89,7 @@ var MarkerLayer = function (_EventEmitter) {
99
89
  this.addPoint(marker, this.markers.length);
100
90
 
101
91
  if (this.mapsService) {
92
+ // 在新增 marker 的时候需要更新聚合信息(哪怕此时的 zoom 没有发生变化)
102
93
  var zoom = this.mapsService.getZoom();
103
94
  var bbox = this.mapsService.getBounds();
104
95
  this.bbox = padBounds(bbox, 0.5);
@@ -119,6 +110,10 @@ var MarkerLayer = function (_EventEmitter) {
119
110
  this.markers.splice(markerIndex, 1);
120
111
  }
121
112
  }
113
+ /**
114
+ * 隐藏 marker 在每个 marker 上单独修改属性而不是在 markerContainer 上修改(在 markerContainer 修改会有用户在场景加载完之前调用失败的问题)
115
+ */
116
+
122
117
  }, {
123
118
  key: "hide",
124
119
  value: function hide() {
@@ -129,6 +124,10 @@ var MarkerLayer = function (_EventEmitter) {
129
124
  m.getElement().style.opacity = '0';
130
125
  });
131
126
  }
127
+ /**
128
+ * 显示 marker
129
+ */
130
+
132
131
  }, {
133
132
  key: "show",
134
133
  value: function show() {
@@ -192,6 +191,7 @@ var MarkerLayer = function (_EventEmitter) {
192
191
  this.points.push(feature);
193
192
 
194
193
  if (this.clusterIndex) {
194
+ // 在新增点的时候需要更新 cluster 的数据
195
195
  this.clusterIndex.load(this.points);
196
196
  }
197
197
  }
@@ -211,7 +211,8 @@ var MarkerLayer = function (_EventEmitter) {
211
211
  radius: radius,
212
212
  minZoom: minZoom,
213
213
  maxZoom: maxZoom
214
- });
214
+ }); // @ts-ignore
215
+
215
216
  this.clusterIndex.load(this.points);
216
217
  }
217
218
  }, {
@@ -230,7 +231,7 @@ var MarkerLayer = function (_EventEmitter) {
230
231
 
231
232
  var _this3$markerLayerOpt = _this3.markerLayerOption.clusterOption,
232
233
  field = _this3$markerLayerOpt.field,
233
- method = _this3$markerLayerOpt.method;
234
+ method = _this3$markerLayerOpt.method; // 处理聚合数据
234
235
 
235
236
  if (feature.properties && (_feature$properties = feature.properties) !== null && _feature$properties !== void 0 && _feature$properties.cluster_id) {
236
237
  var _feature$properties2;
@@ -327,5 +328,4 @@ var MarkerLayer = function (_EventEmitter) {
327
328
  return MarkerLayer;
328
329
  }(EventEmitter);
329
330
 
330
- export { MarkerLayer as default };
331
- //# sourceMappingURL=marker-layer.js.map
331
+ export { MarkerLayer as default };
package/es/marker.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -6,10 +7,6 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
9
 
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
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); }; }
14
11
 
15
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; } }
@@ -18,7 +15,8 @@ import { TYPES } from '@antv/l7-core';
18
15
  import { anchorTranslate, anchorType, applyAnchorClass, bindAll, DOM } from '@antv/l7-utils';
19
16
  import { EventEmitter } from 'eventemitter3';
20
17
 
21
- var Marker = function (_EventEmitter) {
18
+ // marker 支持 dragger 未完成
19
+ var Marker = /*#__PURE__*/function (_EventEmitter) {
22
20
  _inherits(Marker, _EventEmitter);
23
21
 
24
22
  var _super = _createSuper(Marker);
@@ -30,20 +28,6 @@ var Marker = function (_EventEmitter) {
30
28
 
31
29
  _this = _super.call(this);
32
30
 
33
- _defineProperty(_assertThisInitialized(_this), "markerOption", void 0);
34
-
35
- _defineProperty(_assertThisInitialized(_this), "defaultMarker", void 0);
36
-
37
- _defineProperty(_assertThisInitialized(_this), "popup", void 0);
38
-
39
- _defineProperty(_assertThisInitialized(_this), "mapsService", void 0);
40
-
41
- _defineProperty(_assertThisInitialized(_this), "sceneSerive", void 0);
42
-
43
- _defineProperty(_assertThisInitialized(_this), "lngLat", void 0);
44
-
45
- _defineProperty(_assertThisInitialized(_this), "scene", void 0);
46
-
47
31
  _defineProperty(_assertThisInitialized(_this), "added", false);
48
32
 
49
33
  _defineProperty(_assertThisInitialized(_this), "eventHandle", function (e) {
@@ -67,6 +51,7 @@ var Marker = function (_EventEmitter) {
67
51
  value: function getDefault() {
68
52
  return {
69
53
  element: undefined,
54
+ // DOM element
70
55
  anchor: anchorType.BOTTOM,
71
56
  offsets: [0, 0],
72
57
  color: '#5B8FF9',
@@ -76,16 +61,20 @@ var Marker = function (_EventEmitter) {
76
61
  }, {
77
62
  key: "addTo",
78
63
  value: function addTo(scene) {
64
+ // this.remove();
79
65
  this.scene = scene;
80
66
  this.mapsService = scene.get(TYPES.IMapService);
81
67
  this.sceneSerive = scene.get(TYPES.ISceneService);
82
68
  var _this$markerOption = this.markerOption,
83
69
  element = _this$markerOption.element,
84
- draggable = _this$markerOption.draggable;
70
+ draggable = _this$markerOption.draggable; // this.sceneSerive.getSceneContainer().appendChild(element as HTMLElement);
71
+
85
72
  this.mapsService.getMarkerContainer().appendChild(element);
86
73
  this.registerMarkerEvent(element);
87
- this.mapsService.on('camerachange', this.update);
88
- this.mapsService.on('viewchange', this.update);
74
+ this.mapsService.on('camerachange', this.update); // 注册高德1.x 的地图事件监听
75
+
76
+ this.mapsService.on('viewchange', this.update); // 注册高德2.0 的地图事件监听
77
+
89
78
  this.update();
90
79
  this.added = true;
91
80
  this.emit('added');
@@ -319,20 +308,24 @@ var Marker = function (_EventEmitter) {
319
308
  if (container) {
320
309
  containerWidth = container.scrollWidth;
321
310
  containerHeight = container.scrollHeight;
322
- }
311
+ } // 当前可视区域包含跨日界线
312
+
323
313
 
324
314
  if (Math.abs(bounds[0][0]) > 180 || Math.abs(bounds[1][0]) > 180) {
325
315
  if (pos.x > containerWidth) {
316
+ // 日界线右侧点左移
326
317
  var newPos = this.mapsService.lngLatToContainer([lng - 360, lat]);
327
318
  pos.x = newPos.x;
328
319
  }
329
320
 
330
321
  if (pos.x < 0) {
322
+ // 日界线左侧点右移
331
323
  var _newPos = this.mapsService.lngLatToContainer([lng + 360, lat]);
332
324
 
333
325
  pos.x = _newPos.x;
334
326
  }
335
- }
327
+ } // 不在当前可视区域内隐藏点
328
+
336
329
 
337
330
  if (pos.x > containerWidth || pos.x < 0 || pos.y > containerHeight || pos.y < 0) {
338
331
  element.style.display = 'none';
@@ -369,12 +362,14 @@ var Marker = function (_EventEmitter) {
369
362
  }
370
363
 
371
364
  DOM.addClass(element, 'l7-marker');
372
- Object.keys(this.markerOption.style || {}).forEach(function (key) {
365
+ Object.keys(this.markerOption.style || {}).forEach( // @ts-ignore
366
+ function (key) {
373
367
  var _this5$markerOption, _this5$markerOption2;
374
368
 
375
369
  var value = ((_this5$markerOption = _this5.markerOption) === null || _this5$markerOption === void 0 ? void 0 : _this5$markerOption.style) && ((_this5$markerOption2 = _this5.markerOption) === null || _this5$markerOption2 === void 0 ? void 0 : _this5$markerOption2.style[key]);
376
370
 
377
371
  if (element) {
372
+ // @ts-ignore
378
373
  element.style[key] = value;
379
374
  }
380
375
  });
@@ -424,5 +419,4 @@ var Marker = function (_EventEmitter) {
424
419
  return Marker;
425
420
  }(EventEmitter);
426
421
 
427
- export { Marker as default };
428
- //# sourceMappingURL=marker.js.map
422
+ export { Marker as default };
package/es/popup.js CHANGED
@@ -1,14 +1,10 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
5
  import _inherits from "@babel/runtime/helpers/inherits";
5
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
8
 
13
9
  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); }; }
14
10
 
@@ -18,7 +14,8 @@ import { TYPES } from '@antv/l7-core';
18
14
  import { anchorTranslate, anchorType, applyAnchorClass, bindAll, DOM } from '@antv/l7-utils';
19
15
  import { EventEmitter } from 'eventemitter3';
20
16
 
21
- var Popup = function (_EventEmitter) {
17
+ /** colse event */
18
+ var Popup = /*#__PURE__*/function (_EventEmitter) {
22
19
  _inherits(Popup, _EventEmitter);
23
20
 
24
21
  var _super = _createSuper(Popup);
@@ -29,27 +26,6 @@ var Popup = function (_EventEmitter) {
29
26
  _classCallCheck(this, Popup);
30
27
 
31
28
  _this = _super.call(this);
32
-
33
- _defineProperty(_assertThisInitialized(_this), "popupOption", void 0);
34
-
35
- _defineProperty(_assertThisInitialized(_this), "mapsService", void 0);
36
-
37
- _defineProperty(_assertThisInitialized(_this), "sceneSerive", void 0);
38
-
39
- _defineProperty(_assertThisInitialized(_this), "lngLat", void 0);
40
-
41
- _defineProperty(_assertThisInitialized(_this), "content", void 0);
42
-
43
- _defineProperty(_assertThisInitialized(_this), "closeButton", void 0);
44
-
45
- _defineProperty(_assertThisInitialized(_this), "timeoutInstance", void 0);
46
-
47
- _defineProperty(_assertThisInitialized(_this), "container", void 0);
48
-
49
- _defineProperty(_assertThisInitialized(_this), "tip", void 0);
50
-
51
- _defineProperty(_assertThisInitialized(_this), "scene", void 0);
52
-
53
29
  _this.popupOption = _objectSpread(_objectSpread({}, _this.getdefault()), cfg);
54
30
  bindAll(['update', 'onClickClose', 'remove'], _assertThisInitialized(_this));
55
31
  return _this;
@@ -150,7 +126,8 @@ var Popup = function (_EventEmitter) {
150
126
  this.content.appendChild(htmlNode);
151
127
  this.update();
152
128
  return this;
153
- }
129
+ } // 移除popup
130
+
154
131
  }, {
155
132
  key: "remove",
156
133
  value: function remove() {
@@ -159,14 +136,17 @@ var Popup = function (_EventEmitter) {
159
136
  }
160
137
 
161
138
  if (this.container) {
162
- this.removeDom(this.container);
139
+ this.removeDom(this.container); // @ts-ignore
140
+
163
141
  delete this.container;
164
142
  }
165
143
 
166
144
  if (this.mapsService) {
145
+ // TODO: mapbox AMap 事件同步
167
146
  this.mapsService.off('camerachange', this.update);
168
147
  this.mapsService.off('viewchange', this.update);
169
- this.mapsService.off('click', this.onClickClose);
148
+ this.mapsService.off('click', this.onClickClose); // @ts-ignore
149
+
170
150
  delete this.mapsService;
171
151
  }
172
152
 
@@ -192,9 +172,11 @@ var Popup = function (_EventEmitter) {
192
172
  this.closeButton = DOM.create('button', 'l7-popup-close-button', this.content);
193
173
 
194
174
  if (this.popupOption.closeButtonOffsets) {
175
+ // 关闭按钮的偏移
195
176
  this.closeButton.style.right = this.popupOption.closeButtonOffsets[0] + 'px';
196
177
  this.closeButton.style.top = this.popupOption.closeButtonOffsets[1] + 'px';
197
- }
178
+ } // this.closeButton.type = 'button';
179
+
198
180
 
199
181
  this.closeButton.setAttribute('aria-label', 'Close popup');
200
182
  this.closeButton.innerHTML = '&#215;';
@@ -271,7 +253,8 @@ var Popup = function (_EventEmitter) {
271
253
  className.split(' ').forEach(function (name) {
272
254
  return _this3.container.classList.add(name);
273
255
  });
274
- }
256
+ } // 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
257
+
275
258
 
276
259
  var stopPropagation = this.popupOption.stopPropagation;
277
260
 
@@ -314,5 +297,4 @@ var Popup = function (_EventEmitter) {
314
297
  return Popup;
315
298
  }(EventEmitter);
316
299
 
317
- export { Popup as default };
318
- //# sourceMappingURL=popup.js.map
300
+ export { Popup as default };
@@ -32,5 +32,4 @@ export function applyAnchorClass(element, anchor, prefix) {
32
32
  }
33
33
 
34
34
  classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
35
- }
36
- //# sourceMappingURL=anchor.js.map
35
+ }
@@ -1,173 +1,110 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "PositionType", {
9
- enumerable: true,
10
- get: function get() {
11
- return _l7Core.PositionType;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
14
  }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/control/BaseControl.ts
20
+ var BaseControl_exports = {};
21
+ __export(BaseControl_exports, {
22
+ PositionType: () => import_l7_core2.PositionType,
23
+ default: () => Control
13
24
  });
14
- exports.default = void 0;
15
-
16
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
21
-
22
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
-
26
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
-
28
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
-
30
- var _l7Core = require("@antv/l7-core");
31
-
32
- var _l7Utils = require("@antv/l7-utils");
33
-
34
- var _eventemitter = require("eventemitter3");
35
-
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
-
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
-
40
- 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); }; }
41
-
42
- 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; } }
43
-
25
+ module.exports = __toCommonJS(BaseControl_exports);
26
+ var import_l7_core = require("@antv/l7-core");
27
+ var import_l7_utils = require("@antv/l7-utils");
28
+ var import_eventemitter3 = require("eventemitter3");
29
+ var import_l7_core2 = require("@antv/l7-core");
44
30
  var controlId = 0;
45
-
46
- var Control = function (_EventEmitter) {
47
- (0, _inherits2.default)(Control, _EventEmitter);
48
-
49
- var _super = _createSuper(Control);
50
-
51
- function Control(cfg) {
52
- var _this;
53
-
54
- (0, _classCallCheck2.default)(this, Control);
55
- _this = _super.call(this);
56
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "controlOption", void 0);
57
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "container", void 0);
58
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sceneContainer", void 0);
59
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mapsService", void 0);
60
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderService", void 0);
61
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "layerService", void 0);
62
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "controlService", void 0);
63
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isShow", void 0);
64
- _this.controlOption = _objectSpread(_objectSpread({}, _this.getDefault()), cfg || {});
65
- return _this;
31
+ var Control = class extends import_eventemitter3.EventEmitter {
32
+ constructor(cfg) {
33
+ super();
34
+ this.controlOption = {
35
+ ...this.getDefault(),
36
+ ...cfg || {}
37
+ };
66
38
  }
67
-
68
- (0, _createClass2.default)(Control, [{
69
- key: "getDefault",
70
- value: function getDefault() {
71
- return {
72
- position: _l7Core.PositionType.TOPRIGHT,
73
- name: "".concat(controlId++)
74
- };
75
- }
76
- }, {
77
- key: "setPosition",
78
- value: function setPosition() {
79
- var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _l7Core.PositionType.BOTTOMRIGHT;
80
- var controlService = this.controlService;
81
-
82
- if (controlService) {
83
- controlService.removeControl(this);
84
- }
85
-
86
- this.controlOption.position = position;
87
-
88
- if (controlService) {
89
- controlService.addControl(this, this.sceneContainer);
90
- }
91
-
92
- return this;
93
- }
94
- }, {
95
- key: "addTo",
96
- value: function addTo(sceneContainer) {
97
- this.mapsService = sceneContainer.get(_l7Core.TYPES.IMapService);
98
- this.renderService = sceneContainer.get(_l7Core.TYPES.IRendererService);
99
- this.layerService = sceneContainer.get(_l7Core.TYPES.ILayerService);
100
- this.controlService = sceneContainer.get(_l7Core.TYPES.IControlService);
101
- this.sceneContainer = sceneContainer;
102
- this.isShow = true;
103
- this.container = this.onAdd();
104
- var container = this.container;
105
- var pos = this.controlOption.position;
106
- var corner = this.controlService.controlCorners[pos];
107
-
108
- _l7Utils.DOM.addClass(container, 'l7-control');
109
-
110
- if (pos.indexOf('bottom') !== -1) {
111
- corner.insertBefore(container, corner.firstChild);
112
- } else {
113
- corner.appendChild(container);
114
- }
115
-
116
- return this;
117
- }
118
- }, {
119
- key: "onAdd",
120
- value: function onAdd() {
121
- throw new Error('Method not implemented.');
122
- }
123
- }, {
124
- key: "onRemove",
125
- value: function onRemove() {
126
- throw new Error('Method not implemented.');
39
+ getDefault() {
40
+ return {
41
+ position: import_l7_core.PositionType.TOPRIGHT,
42
+ name: `${controlId++}`
43
+ };
44
+ }
45
+ setPosition(position = import_l7_core.PositionType.BOTTOMRIGHT) {
46
+ const controlService = this.controlService;
47
+ if (controlService) {
48
+ controlService.removeControl(this);
127
49
  }
128
- }, {
129
- key: "hide",
130
- value: function hide() {
131
- var container = this.container;
132
-
133
- _l7Utils.DOM.addClass(container, 'l7-control-hide');
134
-
135
- this.isShow = false;
50
+ this.controlOption.position = position;
51
+ if (controlService) {
52
+ controlService.addControl(this, this.sceneContainer);
136
53
  }
137
- }, {
138
- key: "show",
139
- value: function show() {
140
- var container = this.container;
141
-
142
- _l7Utils.DOM.removeClass(container, 'l7-control-hide');
143
-
144
- this.isShow = true;
54
+ return this;
55
+ }
56
+ addTo(sceneContainer) {
57
+ this.mapsService = sceneContainer.get(import_l7_core.TYPES.IMapService);
58
+ this.renderService = sceneContainer.get(import_l7_core.TYPES.IRendererService);
59
+ this.layerService = sceneContainer.get(import_l7_core.TYPES.ILayerService);
60
+ this.controlService = sceneContainer.get(import_l7_core.TYPES.IControlService);
61
+ this.sceneContainer = sceneContainer;
62
+ this.isShow = true;
63
+ this.container = this.onAdd();
64
+ const container = this.container;
65
+ const pos = this.controlOption.position;
66
+ const corner = this.controlService.controlCorners[pos];
67
+ import_l7_utils.DOM.addClass(container, "l7-control");
68
+ if (pos.indexOf("bottom") !== -1) {
69
+ corner.insertBefore(container, corner.firstChild);
70
+ } else {
71
+ corner.appendChild(container);
145
72
  }
146
- }, {
147
- key: "remove",
148
- value: function remove() {
149
- if (!this.mapsService) {
150
- return this;
151
- }
152
-
153
- _l7Utils.DOM.remove(this.container);
154
-
155
- this.onRemove();
73
+ return this;
74
+ }
75
+ onAdd() {
76
+ throw new Error("Method not implemented.");
77
+ }
78
+ onRemove() {
79
+ throw new Error("Method not implemented.");
80
+ }
81
+ hide() {
82
+ const container = this.container;
83
+ import_l7_utils.DOM.addClass(container, "l7-control-hide");
84
+ this.isShow = false;
85
+ }
86
+ show() {
87
+ const container = this.container;
88
+ import_l7_utils.DOM.removeClass(container, "l7-control-hide");
89
+ this.isShow = true;
90
+ }
91
+ remove() {
92
+ if (!this.mapsService) {
93
+ return this;
156
94
  }
157
- }, {
158
- key: "_refocusOnMap",
159
- value: function _refocusOnMap(e) {
160
- if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
161
- var container = this.mapsService.getContainer();
162
-
163
- if (container !== null) {
164
- container.focus();
165
- }
95
+ import_l7_utils.DOM.remove(this.container);
96
+ this.onRemove();
97
+ }
98
+ _refocusOnMap(e) {
99
+ if (this.mapsService && e && e.screenX > 0 && e.screenY > 0) {
100
+ const container = this.mapsService.getContainer();
101
+ if (container !== null) {
102
+ container.focus();
166
103
  }
167
104
  }
168
- }]);
169
- return Control;
170
- }(_eventemitter.EventEmitter);
171
-
172
- exports.default = Control;
173
- //# sourceMappingURL=BaseControl.js.map
105
+ }
106
+ };
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ PositionType
110
+ });