@antv/l7-component 2.9.25-alpha.0 → 2.9.26-alpha.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.
@@ -12,7 +12,6 @@ export default class MarkerLayer extends EventEmitter {
12
12
  private scene;
13
13
  private zoom;
14
14
  private bbox;
15
- private containerSize;
16
15
  constructor(option?: Partial<IMarkerLayerOption>);
17
16
  getDefault(): {
18
17
  cluster: boolean;
@@ -26,8 +25,6 @@ export default class MarkerLayer extends EventEmitter {
26
25
  };
27
26
  };
28
27
  addTo(scene: Container): this;
29
- private setContainerSize;
30
- private getContainerSize;
31
28
  addMarker(marker: IMarker): void;
32
29
  removeMarker(marker: IMarker): void;
33
30
  /**
@@ -77,34 +77,13 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
77
77
  this.mapsService.on('viewchange', this.update); // amap2.0 更新事件
78
78
  }
79
79
 
80
- this.mapsService.on('camerachange', this.setContainerSize.bind(this)); // amap1.x 更新事件
81
-
82
- this.mapsService.on('viewchange', this.setContainerSize.bind(this)); // amap2.0 更新事件
83
-
84
80
  this.addMarkers();
85
81
  return this;
86
82
  }
87
- }, {
88
- key: "setContainerSize",
89
- value: function setContainerSize() {
90
- if (!this.mapsService) return;
91
- var container = this.mapsService.getContainer();
92
- this.containerSize = {
93
- containerWidth: (container === null || container === void 0 ? void 0 : container.scrollWidth) || 0,
94
- containerHeight: (container === null || container === void 0 ? void 0 : container.scrollHeight) || 0,
95
- bounds: this.mapsService.getBounds()
96
- };
97
- }
98
- }, {
99
- key: "getContainerSize",
100
- value: function getContainerSize() {
101
- return this.containerSize;
102
- }
103
83
  }, {
104
84
  key: "addMarker",
105
85
  value: function addMarker(marker) {
106
86
  var cluster = this.markerLayerOption.cluster;
107
- marker.getMarkerLayerContainerSize = this.getContainerSize.bind(this);
108
87
 
109
88
  if (cluster) {
110
89
  this.addPoint(marker, this.markers.length);
@@ -184,8 +163,6 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
184
163
  clusterMarker.remove();
185
164
  });
186
165
  this.mapsService.off('camerachange', this.update);
187
- this.mapsService.off('camerachange', this.setContainerSize.bind(this));
188
- this.mapsService.off('viewchange', this.setContainerSize.bind(this));
189
166
  this.markers = [];
190
167
  this.clusterMarkers = [];
191
168
  }
package/es/marker.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILngLat, IMarkerContainerAndBounds, IMarkerOption, IPoint, IPopup } from '@antv/l7-core';
1
+ import { ILngLat, IMarkerOption, IPoint, IPopup } from '@antv/l7-core';
2
2
  import { anchorType } from '@antv/l7-utils';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import { Container } from 'inversify';
@@ -11,7 +11,6 @@ export default class Marker extends EventEmitter {
11
11
  private lngLat;
12
12
  private scene;
13
13
  private added;
14
- getMarkerLayerContainerSize(): IMarkerContainerAndBounds | void;
15
14
  constructor(option?: Partial<IMarkerOption>);
16
15
  getDefault(): {
17
16
  element: undefined;
@@ -38,7 +37,6 @@ export default class Marker extends EventEmitter {
38
37
  setExtData(data: any): void;
39
38
  private update;
40
39
  private onMapClick;
41
- private getCurrentContainerSize;
42
40
  private updatePosition;
43
41
  private init;
44
42
  private registerMarkerEvent;
package/es/marker.js CHANGED
@@ -47,9 +47,6 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
47
47
  }
48
48
 
49
49
  _createClass(Marker, [{
50
- key: "getMarkerLayerContainerSize",
51
- value: function getMarkerLayerContainerSize() {}
52
- }, {
53
50
  key: "getDefault",
54
51
  value: function getDefault() {
55
52
  return {
@@ -285,16 +282,6 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
285
282
  this.togglePopup();
286
283
  }
287
284
  }
288
- }, {
289
- key: "getCurrentContainerSize",
290
- value: function getCurrentContainerSize() {
291
- var container = this.mapsService.getContainer();
292
- return {
293
- containerHeight: (container === null || container === void 0 ? void 0 : container.scrollHeight) || 0,
294
- containerWidth: (container === null || container === void 0 ? void 0 : container.scrollWidth) || 0,
295
- bounds: this.mapsService.getBounds()
296
- };
297
- }
298
285
  }, {
299
286
  key: "updatePosition",
300
287
  value: function updatePosition() {
@@ -308,18 +295,21 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
308
295
  var _this$lngLat = this.lngLat,
309
296
  lng = _this$lngLat.lng,
310
297
  lat = _this$lngLat.lat;
298
+ var bounds = this.mapsService.getBounds();
311
299
  var pos = this.mapsService.lngLatToContainer([lng, lat]);
312
300
 
313
301
  if (element) {
314
302
  element.style.display = 'block';
315
303
  element.style.whiteSpace = 'nowrap';
304
+ var container = this.mapsService.getContainer();
305
+ var containerWidth = 0;
306
+ var containerHeight = 0;
316
307
 
317
- var _ref = this.getMarkerLayerContainerSize() || this.getCurrentContainerSize(),
318
- containerHeight = _ref.containerHeight,
319
- containerWidth = _ref.containerWidth,
320
- bounds = _ref.bounds;
308
+ if (container) {
309
+ containerWidth = container.scrollWidth;
310
+ containerHeight = container.scrollHeight;
311
+ } // 当前可视区域包含跨日界线
321
312
 
322
- if (!bounds) return; // 当前可视区域包含跨日界线
323
313
 
324
314
  if (Math.abs(bounds[0][0]) > 180 || Math.abs(bounds[1][0]) > 180) {
325
315
  if (pos.x > containerWidth) {
@@ -64,27 +64,11 @@ var MarkerLayer = class extends import_eventemitter3.EventEmitter {
64
64
  this.mapsService.on("camerachange", this.update);
65
65
  this.mapsService.on("viewchange", this.update);
66
66
  }
67
- this.mapsService.on("camerachange", this.setContainerSize.bind(this));
68
- this.mapsService.on("viewchange", this.setContainerSize.bind(this));
69
67
  this.addMarkers();
70
68
  return this;
71
69
  }
72
- setContainerSize() {
73
- if (!this.mapsService)
74
- return;
75
- const container = this.mapsService.getContainer();
76
- this.containerSize = {
77
- containerWidth: (container == null ? void 0 : container.scrollWidth) || 0,
78
- containerHeight: (container == null ? void 0 : container.scrollHeight) || 0,
79
- bounds: this.mapsService.getBounds()
80
- };
81
- }
82
- getContainerSize() {
83
- return this.containerSize;
84
- }
85
70
  addMarker(marker) {
86
71
  const cluster = this.markerLayerOption.cluster;
87
- marker.getMarkerLayerContainerSize = this.getContainerSize.bind(this);
88
72
  if (cluster) {
89
73
  this.addPoint(marker, this.markers.length);
90
74
  if (this.mapsService) {
@@ -137,8 +121,6 @@ var MarkerLayer = class extends import_eventemitter3.EventEmitter {
137
121
  clusterMarker.remove();
138
122
  });
139
123
  this.mapsService.off("camerachange", this.update);
140
- this.mapsService.off("camerachange", this.setContainerSize.bind(this));
141
- this.mapsService.off("viewchange", this.setContainerSize.bind(this));
142
124
  this.markers = [];
143
125
  this.clusterMarkers = [];
144
126
  }
package/lib/marker.js CHANGED
@@ -43,8 +43,6 @@ var Marker = class extends import_eventemitter3.EventEmitter {
43
43
  (0, import_l7_utils.bindAll)(["update", "onMove", "onUp", "addDragHandler", "onMapClick"], this);
44
44
  this.init();
45
45
  }
46
- getMarkerLayerContainerSize() {
47
- }
48
46
  getDefault() {
49
47
  return {
50
48
  element: void 0,
@@ -205,27 +203,24 @@ var Marker = class extends import_eventemitter3.EventEmitter {
205
203
  this.togglePopup();
206
204
  }
207
205
  }
208
- getCurrentContainerSize() {
209
- const container = this.mapsService.getContainer();
210
- return {
211
- containerHeight: (container == null ? void 0 : container.scrollHeight) || 0,
212
- containerWidth: (container == null ? void 0 : container.scrollWidth) || 0,
213
- bounds: this.mapsService.getBounds()
214
- };
215
- }
216
206
  updatePosition() {
217
207
  if (!this.mapsService) {
218
208
  return;
219
209
  }
220
210
  const { element, offsets } = this.markerOption;
221
211
  const { lng, lat } = this.lngLat;
212
+ const bounds = this.mapsService.getBounds();
222
213
  const pos = this.mapsService.lngLatToContainer([lng, lat]);
223
214
  if (element) {
224
215
  element.style.display = "block";
225
216
  element.style.whiteSpace = "nowrap";
226
- const { containerHeight, containerWidth, bounds } = this.getMarkerLayerContainerSize() || this.getCurrentContainerSize();
227
- if (!bounds)
228
- return;
217
+ const container = this.mapsService.getContainer();
218
+ let containerWidth = 0;
219
+ let containerHeight = 0;
220
+ if (container) {
221
+ containerWidth = container.scrollWidth;
222
+ containerHeight = container.scrollHeight;
223
+ }
229
224
  if (Math.abs(bounds[0][0]) > 180 || Math.abs(bounds[1][0]) > 180) {
230
225
  if (pos.x > containerWidth) {
231
226
  const newPos = this.mapsService.lngLatToContainer([lng - 360, lat]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-component",
3
- "version": "2.9.25-alpha.0",
3
+ "version": "2.9.26-alpha.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -25,8 +25,8 @@
25
25
  "author": "lzxue",
26
26
  "license": "ISC",
27
27
  "dependencies": {
28
- "@antv/l7-core": "2.9.25-alpha.0",
29
- "@antv/l7-utils": "2.9.25-alpha.0",
28
+ "@antv/l7-core": "2.9.26-alpha.1",
29
+ "@antv/l7-utils": "2.9.26-alpha.1",
30
30
  "@babel/runtime": "^7.7.7",
31
31
  "eventemitter3": "^4.0.0",
32
32
  "inversify": "^5.0.1",
@@ -35,9 +35,9 @@
35
35
  "supercluster": "^7.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@antv/l7-test-utils": "2.9.25-alpha.0"
38
+ "@antv/l7-test-utils": "2.9.26-alpha.1"
39
39
  },
40
- "gitHead": "5216ad73535dbd3c4188dd9717952db3dfcb4f71",
40
+ "gitHead": "67d87ef5bb69514814e447773c55afe328e7e713",
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  }