@antv/l7-component 2.20.12 → 2.20.13

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.
@@ -88,6 +88,11 @@ export default class LayerPopup extends Popup<ILayerPopupOption> {
88
88
  * @protected
89
89
  */
90
90
  protected isSameFeature(layer: ILayer, featureId: number): boolean | undefined;
91
+ protected setDisplayFeatureInfo(displayFeatureInfo?: {
92
+ layer: ILayer;
93
+ featureId: number;
94
+ }): void;
95
+ protected onLayerHide: () => void;
91
96
  /**
92
97
  * 覆盖 Popup 中的默认的 closeOnClick 行为
93
98
  */
@@ -46,10 +46,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
46
46
  _this.setDOMContent(content);
47
47
  _this.setLnglat(e.lngLat);
48
48
  _this.setTitle(title);
49
- _this.displayFeatureInfo = {
49
+ _this.setDisplayFeatureInfo({
50
50
  layer: layer,
51
51
  featureId: e.featureId
52
- };
52
+ });
53
53
  _this.show();
54
54
  }
55
55
  });
@@ -62,6 +62,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
62
62
  }
63
63
  });
64
64
  });
65
+ _defineProperty(_assertThisInitialized(_this), "onLayerHide", function () {
66
+ _this.hide();
67
+ _this.setDisplayFeatureInfo(undefined);
68
+ });
65
69
  /**
66
70
  * 覆盖 Popup 中的默认的 closeOnClick 行为
67
71
  */
@@ -224,10 +228,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
224
228
  content = _this$getLayerInfoFra2.content;
225
229
  this.setDOMContent(content);
226
230
  this.setTitle(title);
227
- this.displayFeatureInfo = {
231
+ this.setDisplayFeatureInfo({
228
232
  layer: layer,
229
233
  featureId: e.featureId
230
- };
234
+ });
231
235
  this.show();
232
236
  }
233
237
  }
@@ -236,7 +240,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
236
240
  }, {
237
241
  key: "onLayerMouseOut",
238
242
  value: function onLayerMouseOut(layer, e) {
239
- this.displayFeatureInfo = undefined;
243
+ this.setDisplayFeatureInfo(undefined);
240
244
  if (this.isShow) {
241
245
  this.hide();
242
246
  }
@@ -245,7 +249,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
245
249
  key: "onSourceUpdate",
246
250
  value: function onSourceUpdate() {
247
251
  this.hide();
248
- this.displayFeatureInfo = undefined;
252
+ this.setDisplayFeatureInfo(undefined);
249
253
  }
250
254
 
251
255
  /**
@@ -345,6 +349,18 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
345
349
  var displayFeatureInfo = this.displayFeatureInfo;
346
350
  return displayFeatureInfo && layer === displayFeatureInfo.layer && featureId === displayFeatureInfo.featureId;
347
351
  }
352
+ }, {
353
+ key: "setDisplayFeatureInfo",
354
+ value: function setDisplayFeatureInfo(displayFeatureInfo) {
355
+ var oldDisplayFeatureInfo = this.displayFeatureInfo;
356
+ if (oldDisplayFeatureInfo) {
357
+ oldDisplayFeatureInfo.layer.off('hide', this.onLayerHide);
358
+ }
359
+ if (displayFeatureInfo) {
360
+ displayFeatureInfo.layer.on('hide', this.onLayerHide);
361
+ }
362
+ this.displayFeatureInfo = displayFeatureInfo;
363
+ }
348
364
  }]);
349
365
  return LayerPopup;
350
366
  }(Popup);
@@ -52,10 +52,10 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
52
52
  _this.setDOMContent(content);
53
53
  _this.setLnglat(e.lngLat);
54
54
  _this.setTitle(title);
55
- _this.displayFeatureInfo = {
55
+ _this.setDisplayFeatureInfo({
56
56
  layer: layer,
57
57
  featureId: e.featureId
58
- };
58
+ });
59
59
  _this.show();
60
60
  }
61
61
  });
@@ -68,6 +68,10 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
68
68
  }
69
69
  });
70
70
  });
71
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onLayerHide", function () {
72
+ _this.hide();
73
+ _this.setDisplayFeatureInfo(undefined);
74
+ });
71
75
  /**
72
76
  * 覆盖 Popup 中的默认的 closeOnClick 行为
73
77
  */
@@ -230,10 +234,10 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
230
234
  content = _this$getLayerInfoFra2.content;
231
235
  this.setDOMContent(content);
232
236
  this.setTitle(title);
233
- this.displayFeatureInfo = {
237
+ this.setDisplayFeatureInfo({
234
238
  layer: layer,
235
239
  featureId: e.featureId
236
- };
240
+ });
237
241
  this.show();
238
242
  }
239
243
  }
@@ -242,7 +246,7 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
242
246
  }, {
243
247
  key: "onLayerMouseOut",
244
248
  value: function onLayerMouseOut(layer, e) {
245
- this.displayFeatureInfo = undefined;
249
+ this.setDisplayFeatureInfo(undefined);
246
250
  if (this.isShow) {
247
251
  this.hide();
248
252
  }
@@ -251,7 +255,7 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
251
255
  key: "onSourceUpdate",
252
256
  value: function onSourceUpdate() {
253
257
  this.hide();
254
- this.displayFeatureInfo = undefined;
258
+ this.setDisplayFeatureInfo(undefined);
255
259
  }
256
260
 
257
261
  /**
@@ -351,6 +355,18 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
351
355
  var displayFeatureInfo = this.displayFeatureInfo;
352
356
  return displayFeatureInfo && layer === displayFeatureInfo.layer && featureId === displayFeatureInfo.featureId;
353
357
  }
358
+ }, {
359
+ key: "setDisplayFeatureInfo",
360
+ value: function setDisplayFeatureInfo(displayFeatureInfo) {
361
+ var oldDisplayFeatureInfo = this.displayFeatureInfo;
362
+ if (oldDisplayFeatureInfo) {
363
+ oldDisplayFeatureInfo.layer.off('hide', this.onLayerHide);
364
+ }
365
+ if (displayFeatureInfo) {
366
+ displayFeatureInfo.layer.on('hide', this.onLayerHide);
367
+ }
368
+ this.displayFeatureInfo = displayFeatureInfo;
369
+ }
354
370
  }]);
355
371
  return LayerPopup;
356
372
  }(_popup.default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-component",
3
- "version": "2.20.12",
3
+ "version": "2.20.13",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -26,8 +26,8 @@
26
26
  "author": "lzxue",
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@antv/l7-core": "2.20.12",
30
- "@antv/l7-utils": "2.20.12",
29
+ "@antv/l7-core": "2.20.13",
30
+ "@antv/l7-utils": "2.20.13",
31
31
  "@babel/runtime": "^7.7.7",
32
32
  "eventemitter3": "^4.0.0",
33
33
  "inversify": "^5.0.1",
@@ -35,12 +35,12 @@
35
35
  "supercluster": "^7.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@antv/l7-layers": "2.20.12",
39
- "@antv/l7-test-utils": "2.20.12",
38
+ "@antv/l7-layers": "2.20.13",
39
+ "@antv/l7-test-utils": "2.20.13",
40
40
  "gcoord": "^0.3.2",
41
41
  "less": "^4.1.3"
42
42
  },
43
- "gitHead": "82fdda60dd4255ce14405f0a780f235a71d7e0b1",
43
+ "gitHead": "9487cca3bdd14eb2fc81b310e4eae5d30a30496f",
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  }