@antv/l7-component 2.20.20 → 2.21.1

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.
@@ -1,7 +1,6 @@
1
- import type { IControl, IControlService, IGlobalConfigService, ILayerService, IMapService, IRendererService, ISceneService, PositionName } from '@antv/l7-core';
1
+ import type { IControl, IControlService, IGlobalConfigService, ILayerService, IMapService, IRendererService, ISceneService, L7Container, PositionName } from '@antv/l7-core';
2
2
  import { PositionType } from '@antv/l7-core';
3
3
  import EventEmitter from 'eventemitter3';
4
- import type { Container } from 'inversify';
5
4
  import type { ControlEvent } from '../../interface';
6
5
  export { PositionType } from '@antv/l7-core';
7
6
  export { Control };
@@ -31,7 +30,7 @@ export default class Control<O extends IControlOption = IControlOption> extends
31
30
  * @protected
32
31
  */
33
32
  protected isShow: boolean;
34
- protected sceneContainer: Container;
33
+ protected sceneContainer: L7Container;
35
34
  protected scene: ISceneService;
36
35
  protected mapsService: IMapService;
37
36
  protected renderService: IRendererService;
@@ -49,7 +48,7 @@ export default class Control<O extends IControlOption = IControlOption> extends
49
48
  * 当 Control 被添加至 Scene 中,被 controlService 调用的方法
50
49
  * @param sceneContainer
51
50
  */
52
- addTo(sceneContainer: Container): this;
51
+ addTo(sceneContainer: L7Container): this;
53
52
  /**
54
53
  * 将控件移除时触发
55
54
  */
@@ -8,7 +8,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
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); }; }
10
10
  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; } }
11
- import { PositionType, TYPES } from '@antv/l7-core';
11
+ import { PositionType } from '@antv/l7-core';
12
12
  import { DOM } from '@antv/l7-utils';
13
13
  import EventEmitter from 'eventemitter3';
14
14
  export { PositionType } from '@antv/l7-core';
@@ -80,12 +80,12 @@ var Control = /*#__PURE__*/function (_ref) {
80
80
  key: "addTo",
81
81
  value: function addTo(sceneContainer) {
82
82
  // 初始化各个 Service 实例
83
- this.mapsService = sceneContainer.get(TYPES.IMapService);
84
- this.renderService = sceneContainer.get(TYPES.IRendererService);
85
- this.layerService = sceneContainer.get(TYPES.ILayerService);
86
- this.controlService = sceneContainer.get(TYPES.IControlService);
87
- this.configService = sceneContainer.get(TYPES.IGlobalConfigService);
88
- this.scene = sceneContainer.get(TYPES.ISceneService);
83
+ this.mapsService = sceneContainer.mapService;
84
+ this.renderService = sceneContainer.rendererService;
85
+ this.layerService = sceneContainer.layerService;
86
+ this.controlService = sceneContainer.controlService;
87
+ this.configService = sceneContainer.globalConfigService;
88
+ this.scene = sceneContainer.sceneService;
89
89
  this.sceneContainer = sceneContainer;
90
90
  this.isShow = true;
91
91
 
@@ -1,5 +1,4 @@
1
- import type { ILayer } from '@antv/l7-core';
2
- import type { Container } from 'inversify';
1
+ import type { ILayer, L7Container } from '@antv/l7-core';
3
2
  import type { IControlOption } from './baseControl';
4
3
  import { Control } from './baseControl';
5
4
  export interface ISwipeControlOption extends IControlOption {
@@ -32,7 +31,7 @@ export default class Swipe extends Control<ISwipeControlOption> {
32
31
  private maskLayer;
33
32
  getDefault(): ISwipeControlOption;
34
33
  onAdd(): HTMLElement;
35
- addTo(sceneContainer: Container): this;
34
+ addTo(sceneContainer: L7Container): this;
36
35
  onRemove(): void;
37
36
  show(): void;
38
37
  hide(): void;
@@ -11,7 +11,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
11
11
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
12
12
  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); }; }
13
13
  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; } }
14
- import { TYPES, createLayerContainer } from '@antv/l7-core';
14
+ import { createLayerContainer } from '@antv/l7-core';
15
15
  import { PolygonLayer } from '@antv/l7-layers';
16
16
  import { DOM } from '@antv/l7-utils';
17
17
  import { Control } from "./baseControl";
@@ -55,7 +55,6 @@ var Swipe = /*#__PURE__*/function (_Control) {
55
55
  });
56
56
  // fallthrough
57
57
  }
58
-
59
58
  case 'mousemove':
60
59
  case 'touchmove':
61
60
  {
@@ -121,12 +120,10 @@ var Swipe = /*#__PURE__*/function (_Control) {
121
120
  }
122
121
  });
123
122
  _defineProperty(_assertThisInitialized(_this), "getMaskLayer", function () {
123
+ console.log(_this.getMaskGeoData());
124
124
  return new PolygonLayer({
125
125
  visible: false
126
- }).source({
127
- type: 'FeatureCollection',
128
- features: []
129
- }).shape('fill').color('red').style({
126
+ }).source(_this.getMaskGeoData()).shape('fill').color('red').style({
130
127
  opacity: 0.1
131
128
  });
132
129
  });
@@ -177,12 +174,12 @@ var Swipe = /*#__PURE__*/function (_Control) {
177
174
  key: "addTo",
178
175
  value: function addTo(sceneContainer) {
179
176
  // 初始化各个 Service 实例
180
- this.mapsService = sceneContainer.get(TYPES.IMapService);
181
- this.renderService = sceneContainer.get(TYPES.IRendererService);
182
- this.layerService = sceneContainer.get(TYPES.ILayerService);
183
- this.controlService = sceneContainer.get(TYPES.IControlService);
184
- this.configService = sceneContainer.get(TYPES.IGlobalConfigService);
185
- this.scene = sceneContainer.get(TYPES.ISceneService);
177
+ this.mapsService = sceneContainer.mapService;
178
+ this.renderService = sceneContainer.rendererService;
179
+ this.layerService = sceneContainer.layerService;
180
+ this.controlService = sceneContainer.controlService;
181
+ this.configService = sceneContainer.globalConfigService;
182
+ this.scene = sceneContainer.sceneService;
186
183
  this.sceneContainer = sceneContainer;
187
184
  this.isShow = true;
188
185
 
@@ -204,17 +201,16 @@ var Swipe = /*#__PURE__*/function (_Control) {
204
201
  // this.scene.getSceneContainer().appendChild(this.container);
205
202
  this.mapsService.getMarkerContainer().appendChild(this.container);
206
203
  this.maskLayer = this.getMaskLayer();
207
- this.updateMask();
208
204
  this.registerEvent();
209
205
 
210
- // 给图层挂载掩膜
211
- this.addMaskToLayers(layers, false);
212
- this.addMaskToLayers(rightLayers, true);
213
-
214
206
  // 添加掩膜图层到 scene
215
207
  var layerContainer = createLayerContainer(sceneContainer);
216
- this.maskLayer.setContainer(layerContainer, sceneContainer);
208
+ this.maskLayer.setContainer(layerContainer);
217
209
  this.scene.addLayer(this.maskLayer);
210
+
211
+ // 给图层挂载掩膜
212
+ this.addMaskToLayers(layers, false);
213
+ this.addMaskToLayers(rightLayers, true);
218
214
  this.emit('add', this);
219
215
  return this;
220
216
  }
@@ -1,6 +1,5 @@
1
- import type { IMarker } from '@antv/l7-core';
1
+ import type { IMarker, L7Container } from '@antv/l7-core';
2
2
  import { EventEmitter } from 'eventemitter3';
3
- import type { Container } from 'inversify';
4
3
  import type { IMarkerLayerOption } from './interface';
5
4
  export default class MarkerLayer extends EventEmitter {
6
5
  private markers;
@@ -26,7 +25,7 @@ export default class MarkerLayer extends EventEmitter {
26
25
  className: string;
27
26
  };
28
27
  };
29
- addTo(scene: Container): this;
28
+ addTo(scene: L7Container): this;
30
29
  private setContainerSize;
31
30
  private getContainerSize;
32
31
  addMarker(marker: IMarker): void;
@@ -8,7 +8,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
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); }; }
10
10
  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; } }
11
- import { TYPES } from '@antv/l7-core';
12
11
  import { DOM, Satistics, bindAll, boundsContains, lodashUtil, padBounds } from '@antv/l7-utils';
13
12
  import { EventEmitter } from 'eventemitter3';
14
13
  // @ts-ignore
@@ -56,7 +55,7 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
56
55
  value: function addTo(scene) {
57
56
  // this.remove();
58
57
  this.scene = scene;
59
- this.mapsService = scene.get(TYPES.IMapService);
58
+ this.mapsService = scene.mapService;
60
59
  if (this.markerLayerOption.cluster) {
61
60
  this.initCluster();
62
61
  this.update();
@@ -64,7 +63,6 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
64
63
  this.mapsService.on('camerachange', this.update); // amap1.x 更新事件
65
64
  this.mapsService.on('viewchange', this.update); // amap2.0 更新事件
66
65
  }
67
-
68
66
  this.mapsService.on('camerachange', this.setContainerSize.bind(this)); // amap1.x 更新事件
69
67
  this.mapsService.on('viewchange', this.setContainerSize.bind(this)); // amap2.0 更新事件
70
68
  this.addMarkers();
package/es/marker.d.ts CHANGED
@@ -1,13 +1,10 @@
1
- import type { ILngLat, IMarkerContainerAndBounds, IMarkerOption, IPoint, IPopup } from '@antv/l7-core';
1
+ import type { ILngLat, IMarkerContainerAndBounds, IMarkerOption, IPoint, IPopup, L7Container } from '@antv/l7-core';
2
2
  import { anchorType } from '@antv/l7-utils';
3
3
  import { EventEmitter } from 'eventemitter3';
4
- import type { Container } from 'inversify';
5
4
  export default class Marker extends EventEmitter {
6
5
  private markerOption;
7
- private defaultMarker;
8
6
  private popup;
9
7
  private mapsService;
10
- private sceneSerive;
11
8
  private lngLat;
12
9
  private scene;
13
10
  private added;
@@ -21,7 +18,7 @@ export default class Marker extends EventEmitter {
21
18
  color: string;
22
19
  draggable: boolean;
23
20
  };
24
- addTo(scene: Container): this;
21
+ addTo(scene: L7Container): this;
25
22
  remove(): this;
26
23
  setLnglat(lngLat: ILngLat | IPoint): this;
27
24
  getLnglat(): ILngLat;
package/es/marker.js CHANGED
@@ -8,9 +8,9 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
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); }; }
10
10
  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; } }
11
- import { TYPES } from '@antv/l7-core';
12
- import { DOM, anchorType, applyAnchorClass, bindAll, isPC, anchorTranslate } from '@antv/l7-utils';
11
+ import { DOM, anchorTranslate, anchorType, applyAnchorClass, bindAll, isPC } from '@antv/l7-utils';
13
12
  import { EventEmitter } from 'eventemitter3';
13
+
14
14
  // marker 支持 dragger 未完成
15
15
  var Marker = /*#__PURE__*/function (_EventEmitter) {
16
16
  _inherits(Marker, _EventEmitter);
@@ -58,7 +58,7 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
58
58
  _this.preLngLat = e.lnglat;
59
59
  _this.emit('dragging', newLngLat);
60
60
  });
61
- _defineProperty(_assertThisInitialized(_this), "onMarkerDragEnd", function (e) {
61
+ _defineProperty(_assertThisInitialized(_this), "onMarkerDragEnd", function () {
62
62
  _this.mapsService.setMapStatus({
63
63
  dragEnable: true,
64
64
  zoomEnable: true
@@ -100,16 +100,11 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
100
100
  }, {
101
101
  key: "addTo",
102
102
  value: function addTo(scene) {
103
- // this.remove();
104
103
  this.scene = scene;
105
- this.mapsService = scene.get(TYPES.IMapService);
106
- this.sceneSerive = scene.get(TYPES.ISceneService);
104
+ this.mapsService = scene.mapService;
107
105
  var element = this.markerOption.element;
108
- // this.sceneSerive.getSceneContainer().appendChild(element as HTMLElement);
109
106
  this.mapsService.getMarkerContainer().appendChild(element);
110
107
  this.registerMarkerEvent(element);
111
- //天地图仅监听zoomchange 不注册camerachane,对于平移,在mapsService中实现
112
- // this.mapsService.on('zoomchange', this.updatePositionWhenZoom);
113
108
  this.mapsService.on('camerachange', this.update); // 注册高德1.x 的地图事件监听
114
109
  this.update();
115
110
  this.updateDraggable();
@@ -124,7 +119,6 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
124
119
  this.mapsService.off('click', this.onMapClick);
125
120
  this.mapsService.off('move', this.update);
126
121
  this.mapsService.off('moveend', this.update);
127
- // this.mapsService.off('zoomchange', this.update);
128
122
  this.mapsService.off('camerachange', this.update);
129
123
  }
130
124
  this.unRegisterMarkerEvent();
@@ -407,7 +401,6 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
407
401
  }
408
402
  element.style.left = pos.x + offsets[0] + 'px';
409
403
  element.style.top = pos.y - offsets[1] + 'px';
410
- console.log(element.style.left);
411
404
  }
412
405
  }
413
406
  }, {
@@ -419,7 +412,6 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
419
412
  color = _this$markerOption4.color,
420
413
  anchor = _this$markerOption4.anchor;
421
414
  if (!element) {
422
- this.defaultMarker = true;
423
415
  element = DOM.create('div');
424
416
  this.markerOption.element = element;
425
417
  var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -1,6 +1,5 @@
1
- import type { ILayer, IPopupOption } from '@antv/l7-core';
1
+ import type { ILayer, IPopupOption, L7Container } from '@antv/l7-core';
2
2
  import { DOM } from '@antv/l7-utils';
3
- import type { Container } from 'inversify';
4
3
  import Popup from './popup';
5
4
  type ElementType = DOM.ElementType;
6
5
  export type LayerField = {
@@ -46,7 +45,7 @@ export default class LayerPopup extends Popup<ILayerPopupOption> {
46
45
  featureId: number;
47
46
  };
48
47
  protected get layerConfigItems(): LayerPopupConfigItem[];
49
- addTo(scene: Container): this;
48
+ addTo(scene: L7Container): this;
50
49
  remove(): this;
51
50
  setOptions(option: Partial<ILayerPopupOption>): this;
52
51
  protected getDefault(option: Partial<ILayerPopupOption>): ILayerPopupOption;
@@ -1,7 +1,6 @@
1
- import type { ILayerService, ILngLat, IMapService, IPopup, IPopupOption, ISceneService } from '@antv/l7-core';
1
+ import type { ILayerService, ILngLat, IMapService, IPopup, IPopupOption, ISceneService, L7Container } from '@antv/l7-core';
2
2
  import { DOM } from '@antv/l7-utils';
3
3
  import { EventEmitter } from 'eventemitter3';
4
- import type { Container } from 'inversify';
5
4
  type ElementType = DOM.ElementType;
6
5
  export { Popup };
7
6
  export default class Popup<O extends IPopupOption = IPopupOption> extends EventEmitter implements IPopup {
@@ -13,7 +12,7 @@ export default class Popup<O extends IPopupOption = IPopupOption> extends EventE
13
12
  protected mapsService: IMapService;
14
13
  protected sceneService: ISceneService;
15
14
  protected layerService: ILayerService;
16
- protected scene: Container;
15
+ protected scene: L7Container;
17
16
  /**
18
17
  * 关闭按钮对应的 DOM
19
18
  * @protected
@@ -53,7 +52,7 @@ export default class Popup<O extends IPopupOption = IPopupOption> extends EventE
53
52
  protected set lngLat(newLngLat: ILngLat);
54
53
  constructor(cfg?: Partial<O>);
55
54
  getIsShow(): boolean;
56
- addTo(scene: Container): this;
55
+ addTo(scene: L7Container): this;
57
56
  remove(): this | undefined;
58
57
  /**
59
58
  * 获取 option 配置
package/es/popup/popup.js CHANGED
@@ -8,8 +8,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
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); }; }
10
10
  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; } }
11
- import { TYPES } from '@antv/l7-core';
12
- import { anchorTranslate, anchorType, applyAnchorClass, DOM } from '@antv/l7-utils';
11
+ import { DOM, anchorTranslate, anchorType, applyAnchorClass } from '@antv/l7-utils';
13
12
  import { EventEmitter } from 'eventemitter3';
14
13
  import { createL7Icon } from "../utils/icon";
15
14
  export { Popup };
@@ -84,12 +83,6 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
84
83
  if (!_this.mapsService || _this.popupOption.followCursor) {
85
84
  return;
86
85
  }
87
- var _this$lngLat2 = _this.lngLat,
88
- lng = _this$lngLat2.lng,
89
- lat = _this$lngLat2.lat;
90
- var _this$mapsService$lng2 = _this.mapsService.lngLatToContainer([lng, lat]),
91
- x = _this$mapsService$lng2.x,
92
- y = _this$mapsService$lng2.y;
93
86
  var map = ev.map;
94
87
  var viewHalf = map.getSize();
95
88
  viewHalf.x = viewHalf.x / 2;
@@ -195,9 +188,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
195
188
  }, {
196
189
  key: "addTo",
197
190
  value: function addTo(scene) {
198
- this.mapsService = scene.get(TYPES.IMapService);
199
- this.sceneService = scene.get(TYPES.ISceneService);
200
- this.layerService = scene.get(TYPES.ILayerService);
191
+ this.mapsService = scene.mapService;
192
+ this.sceneService = scene.sceneService;
193
+ this.layerService = scene.layerService;
201
194
  //天地图仅监听zoomchange 不注册camerachane,对于平移,在mapsService中实现
202
195
  // this.mapsService.on('zoomchange', this.updateWhenZoom);
203
196
  this.mapsService.on('camerachange', this.update);
@@ -390,9 +383,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
390
383
  }, {
391
384
  key: "panToPopup",
392
385
  value: function panToPopup() {
393
- var _this$lngLat3 = this.lngLat,
394
- lng = _this$lngLat3.lng,
395
- lat = _this$lngLat3.lat;
386
+ var _this$lngLat2 = this.lngLat,
387
+ lng = _this$lngLat2.lng,
388
+ lat = _this$lngLat2.lat;
396
389
  if (this.popupOption.autoPan) {
397
390
  this.mapsService.panTo([lng, lat]);
398
391
  }
@@ -48,7 +48,6 @@ export var Popper = /*#__PURE__*/function (_EventEmitter) {
48
48
  DOM.removeClass(_this.popperDOM, 'l7-popper-hide');
49
49
  _this.isShow = true;
50
50
  if (_this.option.unique) {
51
- // console.log(Popper.conflictPopperList.length);
52
51
  Popper.conflictPopperList.forEach(function (popper) {
53
52
  if (popper !== _assertThisInitialized(_this) && popper.isShow) {
54
53
  popper.hide();
@@ -92,12 +92,12 @@ var Control = exports.default = exports.Control = /*#__PURE__*/function (_ref) {
92
92
  key: "addTo",
93
93
  value: function addTo(sceneContainer) {
94
94
  // 初始化各个 Service 实例
95
- this.mapsService = sceneContainer.get(_l7Core.TYPES.IMapService);
96
- this.renderService = sceneContainer.get(_l7Core.TYPES.IRendererService);
97
- this.layerService = sceneContainer.get(_l7Core.TYPES.ILayerService);
98
- this.controlService = sceneContainer.get(_l7Core.TYPES.IControlService);
99
- this.configService = sceneContainer.get(_l7Core.TYPES.IGlobalConfigService);
100
- this.scene = sceneContainer.get(_l7Core.TYPES.ISceneService);
95
+ this.mapsService = sceneContainer.mapService;
96
+ this.renderService = sceneContainer.rendererService;
97
+ this.layerService = sceneContainer.layerService;
98
+ this.controlService = sceneContainer.controlService;
99
+ this.configService = sceneContainer.globalConfigService;
100
+ this.scene = sceneContainer.sceneService;
101
101
  this.sceneContainer = sceneContainer;
102
102
  this.isShow = true;
103
103
 
@@ -61,7 +61,6 @@ var Swipe = exports.default = exports.Swipe = /*#__PURE__*/function (_Control) {
61
61
  });
62
62
  // fallthrough
63
63
  }
64
-
65
64
  case 'mousemove':
66
65
  case 'touchmove':
67
66
  {
@@ -127,12 +126,10 @@ var Swipe = exports.default = exports.Swipe = /*#__PURE__*/function (_Control) {
127
126
  }
128
127
  });
129
128
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getMaskLayer", function () {
129
+ console.log(_this.getMaskGeoData());
130
130
  return new _l7Layers.PolygonLayer({
131
131
  visible: false
132
- }).source({
133
- type: 'FeatureCollection',
134
- features: []
135
- }).shape('fill').color('red').style({
132
+ }).source(_this.getMaskGeoData()).shape('fill').color('red').style({
136
133
  opacity: 0.1
137
134
  });
138
135
  });
@@ -183,12 +180,12 @@ var Swipe = exports.default = exports.Swipe = /*#__PURE__*/function (_Control) {
183
180
  key: "addTo",
184
181
  value: function addTo(sceneContainer) {
185
182
  // 初始化各个 Service 实例
186
- this.mapsService = sceneContainer.get(_l7Core.TYPES.IMapService);
187
- this.renderService = sceneContainer.get(_l7Core.TYPES.IRendererService);
188
- this.layerService = sceneContainer.get(_l7Core.TYPES.ILayerService);
189
- this.controlService = sceneContainer.get(_l7Core.TYPES.IControlService);
190
- this.configService = sceneContainer.get(_l7Core.TYPES.IGlobalConfigService);
191
- this.scene = sceneContainer.get(_l7Core.TYPES.ISceneService);
183
+ this.mapsService = sceneContainer.mapService;
184
+ this.renderService = sceneContainer.rendererService;
185
+ this.layerService = sceneContainer.layerService;
186
+ this.controlService = sceneContainer.controlService;
187
+ this.configService = sceneContainer.globalConfigService;
188
+ this.scene = sceneContainer.sceneService;
192
189
  this.sceneContainer = sceneContainer;
193
190
  this.isShow = true;
194
191
 
@@ -210,17 +207,16 @@ var Swipe = exports.default = exports.Swipe = /*#__PURE__*/function (_Control) {
210
207
  // this.scene.getSceneContainer().appendChild(this.container);
211
208
  this.mapsService.getMarkerContainer().appendChild(this.container);
212
209
  this.maskLayer = this.getMaskLayer();
213
- this.updateMask();
214
210
  this.registerEvent();
215
211
 
216
- // 给图层挂载掩膜
217
- this.addMaskToLayers(layers, false);
218
- this.addMaskToLayers(rightLayers, true);
219
-
220
212
  // 添加掩膜图层到 scene
221
213
  var layerContainer = (0, _l7Core.createLayerContainer)(sceneContainer);
222
- this.maskLayer.setContainer(layerContainer, sceneContainer);
214
+ this.maskLayer.setContainer(layerContainer);
223
215
  this.scene.addLayer(this.maskLayer);
216
+
217
+ // 给图层挂载掩膜
218
+ this.addMaskToLayers(layers, false);
219
+ this.addMaskToLayers(rightLayers, true);
224
220
  this.emit('add', this);
225
221
  return this;
226
222
  }
@@ -13,7 +13,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _l7Core = require("@antv/l7-core");
17
16
  var _l7Utils = require("@antv/l7-utils");
18
17
  var _eventemitter = require("eventemitter3");
19
18
  var _supercluster = _interopRequireDefault(require("supercluster/dist/supercluster"));
@@ -62,7 +61,7 @@ var MarkerLayer = exports.default = /*#__PURE__*/function (_EventEmitter) {
62
61
  value: function addTo(scene) {
63
62
  // this.remove();
64
63
  this.scene = scene;
65
- this.mapsService = scene.get(_l7Core.TYPES.IMapService);
64
+ this.mapsService = scene.mapService;
66
65
  if (this.markerLayerOption.cluster) {
67
66
  this.initCluster();
68
67
  this.update();
@@ -70,7 +69,6 @@ var MarkerLayer = exports.default = /*#__PURE__*/function (_EventEmitter) {
70
69
  this.mapsService.on('camerachange', this.update); // amap1.x 更新事件
71
70
  this.mapsService.on('viewchange', this.update); // amap2.0 更新事件
72
71
  }
73
-
74
72
  this.mapsService.on('camerachange', this.setContainerSize.bind(this)); // amap1.x 更新事件
75
73
  this.mapsService.on('viewchange', this.setContainerSize.bind(this)); // amap2.0 更新事件
76
74
  this.addMarkers();
package/lib/marker.js CHANGED
@@ -13,7 +13,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _l7Core = require("@antv/l7-core");
17
16
  var _l7Utils = require("@antv/l7-utils");
18
17
  var _eventemitter = require("eventemitter3");
19
18
  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); }; }
@@ -65,7 +64,7 @@ var Marker = exports.default = /*#__PURE__*/function (_EventEmitter) {
65
64
  _this.preLngLat = e.lnglat;
66
65
  _this.emit('dragging', newLngLat);
67
66
  });
68
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMarkerDragEnd", function (e) {
67
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMarkerDragEnd", function () {
69
68
  _this.mapsService.setMapStatus({
70
69
  dragEnable: true,
71
70
  zoomEnable: true
@@ -107,16 +106,11 @@ var Marker = exports.default = /*#__PURE__*/function (_EventEmitter) {
107
106
  }, {
108
107
  key: "addTo",
109
108
  value: function addTo(scene) {
110
- // this.remove();
111
109
  this.scene = scene;
112
- this.mapsService = scene.get(_l7Core.TYPES.IMapService);
113
- this.sceneSerive = scene.get(_l7Core.TYPES.ISceneService);
110
+ this.mapsService = scene.mapService;
114
111
  var element = this.markerOption.element;
115
- // this.sceneSerive.getSceneContainer().appendChild(element as HTMLElement);
116
112
  this.mapsService.getMarkerContainer().appendChild(element);
117
113
  this.registerMarkerEvent(element);
118
- //天地图仅监听zoomchange 不注册camerachane,对于平移,在mapsService中实现
119
- // this.mapsService.on('zoomchange', this.updatePositionWhenZoom);
120
114
  this.mapsService.on('camerachange', this.update); // 注册高德1.x 的地图事件监听
121
115
  this.update();
122
116
  this.updateDraggable();
@@ -131,7 +125,6 @@ var Marker = exports.default = /*#__PURE__*/function (_EventEmitter) {
131
125
  this.mapsService.off('click', this.onMapClick);
132
126
  this.mapsService.off('move', this.update);
133
127
  this.mapsService.off('moveend', this.update);
134
- // this.mapsService.off('zoomchange', this.update);
135
128
  this.mapsService.off('camerachange', this.update);
136
129
  }
137
130
  this.unRegisterMarkerEvent();
@@ -414,7 +407,6 @@ var Marker = exports.default = /*#__PURE__*/function (_EventEmitter) {
414
407
  }
415
408
  element.style.left = pos.x + offsets[0] + 'px';
416
409
  element.style.top = pos.y - offsets[1] + 'px';
417
- console.log(element.style.left);
418
410
  }
419
411
  }
420
412
  }, {
@@ -426,7 +418,6 @@ var Marker = exports.default = /*#__PURE__*/function (_EventEmitter) {
426
418
  color = _this$markerOption4.color,
427
419
  anchor = _this$markerOption4.anchor;
428
420
  if (!element) {
429
- this.defaultMarker = true;
430
421
  element = _l7Utils.DOM.create('div');
431
422
  this.markerOption.element = element;
432
423
  var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -13,7 +13,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _l7Core = require("@antv/l7-core");
17
16
  var _l7Utils = require("@antv/l7-utils");
18
17
  var _eventemitter = require("eventemitter3");
19
18
  var _icon = require("../utils/icon");
@@ -90,12 +89,6 @@ var Popup = exports.default = exports.Popup = /*#__PURE__*/function (_EventEmitt
90
89
  if (!_this.mapsService || _this.popupOption.followCursor) {
91
90
  return;
92
91
  }
93
- var _this$lngLat2 = _this.lngLat,
94
- lng = _this$lngLat2.lng,
95
- lat = _this$lngLat2.lat;
96
- var _this$mapsService$lng2 = _this.mapsService.lngLatToContainer([lng, lat]),
97
- x = _this$mapsService$lng2.x,
98
- y = _this$mapsService$lng2.y;
99
92
  var map = ev.map;
100
93
  var viewHalf = map.getSize();
101
94
  viewHalf.x = viewHalf.x / 2;
@@ -201,9 +194,9 @@ var Popup = exports.default = exports.Popup = /*#__PURE__*/function (_EventEmitt
201
194
  }, {
202
195
  key: "addTo",
203
196
  value: function addTo(scene) {
204
- this.mapsService = scene.get(_l7Core.TYPES.IMapService);
205
- this.sceneService = scene.get(_l7Core.TYPES.ISceneService);
206
- this.layerService = scene.get(_l7Core.TYPES.ILayerService);
197
+ this.mapsService = scene.mapService;
198
+ this.sceneService = scene.sceneService;
199
+ this.layerService = scene.layerService;
207
200
  //天地图仅监听zoomchange 不注册camerachane,对于平移,在mapsService中实现
208
201
  // this.mapsService.on('zoomchange', this.updateWhenZoom);
209
202
  this.mapsService.on('camerachange', this.update);
@@ -396,9 +389,9 @@ var Popup = exports.default = exports.Popup = /*#__PURE__*/function (_EventEmitt
396
389
  }, {
397
390
  key: "panToPopup",
398
391
  value: function panToPopup() {
399
- var _this$lngLat3 = this.lngLat,
400
- lng = _this$lngLat3.lng,
401
- lat = _this$lngLat3.lat;
392
+ var _this$lngLat2 = this.lngLat,
393
+ lng = _this$lngLat2.lng,
394
+ lat = _this$lngLat2.lat;
402
395
  if (this.popupOption.autoPan) {
403
396
  this.mapsService.panTo([lng, lat]);
404
397
  }
@@ -51,7 +51,6 @@ var Popper = exports.Popper = /*#__PURE__*/function (_EventEmitter) {
51
51
  _l7Utils.DOM.removeClass(_this.popperDOM, 'l7-popper-hide');
52
52
  _this.isShow = true;
53
53
  if (_this.option.unique) {
54
- // console.log(Popper.conflictPopperList.length);
55
54
  Popper.conflictPopperList.forEach(function (popper) {
56
55
  if (popper !== (0, _assertThisInitialized2.default)(_this) && popper.isShow) {
57
56
  popper.hide();
package/package.json CHANGED
@@ -1,47 +1,45 @@
1
1
  {
2
2
  "name": "@antv/l7-component",
3
- "version": "2.20.20",
3
+ "version": "2.21.1",
4
4
  "description": "",
5
+ "license": "ISC",
6
+ "author": "lzxue",
7
+ "sideEffects": true,
5
8
  "main": "lib/index.js",
6
9
  "module": "es/index.js",
7
10
  "types": "es/index.d.ts",
8
- "sideEffects": true,
9
11
  "files": [
10
12
  "lib",
11
13
  "es",
12
14
  "README.md"
13
15
  ],
14
16
  "scripts": {
15
- "tsc": "tsc --project tsconfig.build.json",
16
- "less": "lessc src/css/index.less src/css/index.css",
17
- "clean": "rimraf dist; rimraf es; rimraf lib;",
18
17
  "build": "father build",
19
18
  "build:cjs": "BABEL_ENV=cjs babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
20
19
  "build:esm": "BABEL_ENV=esm babel src --root-mode upward --out-dir es --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
21
- "watch": "BABEL_ENV=cjs babel src --watch --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
20
+ "clean": "rimraf dist; rimraf es; rimraf lib;",
21
+ "less": "lessc src/css/index.less src/css/index.css",
22
22
  "lint:ts": "run-p -c lint:ts-*",
23
+ "sync": "tnpm sync",
23
24
  "test": "umi-test --passWithNoTests",
24
- "sync": "tnpm sync"
25
+ "tsc": "tsc --project tsconfig.build.json",
26
+ "watch": "BABEL_ENV=cjs babel src --watch --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments"
25
27
  },
26
- "author": "lzxue",
27
- "license": "ISC",
28
28
  "dependencies": {
29
- "@antv/l7-core": "2.20.20",
30
- "@antv/l7-utils": "2.20.20",
29
+ "@antv/l7-core": "2.21.1",
30
+ "@antv/l7-utils": "2.21.1",
31
31
  "@babel/runtime": "^7.7.7",
32
32
  "eventemitter3": "^4.0.0",
33
- "inversify": "^5.0.1",
34
- "reflect-metadata": "^0.2.1",
35
33
  "supercluster": "^7.0.0"
36
34
  },
37
35
  "devDependencies": {
38
- "@antv/l7-layers": "2.20.20",
39
- "@antv/l7-test-utils": "2.20.20",
36
+ "@antv/l7-layers": "2.21.1",
37
+ "@antv/l7-test-utils": "2.21.1",
40
38
  "gcoord": "^0.3.2",
41
39
  "less": "^4.1.3"
42
40
  },
43
- "gitHead": "1966dbadf9efee8d69d22beb4d89947c158da634",
44
41
  "publishConfig": {
45
42
  "access": "public"
46
- }
43
+ },
44
+ "gitHead": "1e0d2e5920f479f77095a2c5eddda8a8d7ac9e0f"
47
45
  }