@vtx/map 1.1.16 → 1.1.17

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.
@@ -296,7 +296,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
296
296
 
297
297
 
298
298
  if (t.props.showControl) {
299
- t.showControl(t.props.showControl);
299
+ t.showControl(t.props);
300
300
  } // 画热力图
301
301
 
302
302
 
@@ -1805,7 +1805,13 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1805
1805
  var myImage = new Image(cg.width, cg.height);
1806
1806
 
1807
1807
  if (!!item.markerContent) {
1808
- var nodes = t.parseDom(item.markerContent)[0]; // 创建地图自定义覆盖物
1808
+ var nodes = t.parseDom(item.markerContent)[0]; // 自定义图层需要把事件加在dom上
1809
+
1810
+ nodes.addEventListener("click", function (e) {
1811
+ t.clickGraphic(item.id, _objectSpread(_objectSpread({}, e), {}, {
1812
+ pixel: [e.clientX, e.clientY]
1813
+ }));
1814
+ }); // 创建地图自定义覆盖物
1809
1815
 
1810
1816
  var pop = new ol.Overlay({
1811
1817
  id: item.id,
@@ -1985,6 +1991,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1985
1991
  if (item.markerContent) {
1986
1992
  var overlay = t.state.gis.getOverlayById(item.id);
1987
1993
  var nodes = t.parseDom(item.markerContent)[0];
1994
+ nodes.addEventListener("click", function (e) {
1995
+ t.clickGraphic(item.id, _objectSpread(_objectSpread({}, e), {}, {
1996
+ pixel: [e.clientX, e.clientY]
1997
+ }));
1998
+ });
1988
1999
  overlay.setElement(nodes);
1989
2000
  overlay.setPosition([parseFloat(item.longitude), parseFloat(item.latitude)]);
1990
2001
  t.state.gis.changed();
@@ -2582,6 +2593,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2582
2593
  //清除对应id的图元数据缓存
2583
2594
 
2584
2595
  t.GM.removeGraphic(id);
2596
+ t.GM.removeGraphicParam(id);
2597
+
2598
+ if (t.state.gis.getOverlayById(id)) {
2599
+ t.state.gis.removeOverlay(t.state.gis.getOverlayById(id));
2600
+ }
2585
2601
  } else {
2586
2602
  return false;
2587
2603
  }
@@ -2784,29 +2800,29 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2784
2800
  if (config.location == 'tl') {
2785
2801
  $("div.ol-scale-line-".concat(config.location)).css({
2786
2802
  position: 'absolute',
2787
- left: config.offset[0] + 65,
2788
- top: config.offset[1],
2803
+ left: config.offset ? config.offset[0] : 0 + 65,
2804
+ top: config.offset ? config.offset[1] : 0,
2789
2805
  textAlign: 'center'
2790
2806
  });
2791
2807
  } else if (config.location == 'bl') {
2792
2808
  $("div.ol-scale-line-".concat(config.location)).css({
2793
2809
  position: 'absolute',
2794
- left: config.offset[0] + 65,
2795
- bottom: config.offset[1],
2810
+ left: config.offset ? config.offset[0] : 0 + 65,
2811
+ bottom: config.offset ? config.offset[1] : 0,
2796
2812
  textAlign: 'center'
2797
2813
  });
2798
2814
  } else if (config.location == 'tr') {
2799
2815
  $("div.ol-scale-line-".concat(config.location)).css({
2800
2816
  position: 'absolute',
2801
- right: config.offset[0] + 65,
2802
- top: config.offset[1],
2817
+ right: config.offset ? config.offset[0] : 0 + 65,
2818
+ top: config.offset ? config.offset[1] : 0,
2803
2819
  textAlign: 'center'
2804
2820
  });
2805
2821
  } else if (config.location == 'br') {
2806
2822
  $("div.ol-scale-line-".concat(config.location)).css({
2807
2823
  position: 'absolute',
2808
- right: config.offset[0] + 65,
2809
- bottom: config.offset[1],
2824
+ right: config.offset ? config.offset[0] : 0 + 65,
2825
+ bottom: config.offset ? config.offset[1] : 0,
2810
2826
  textAlign: 'center'
2811
2827
  });
2812
2828
  }