@vtx/map 1.1.16 → 1.1.18

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
 
@@ -878,7 +878,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
878
878
  anchor: [-drawParam.parameter.markerContentX || -15, -drawParam.parameter.markerContentY || -15],
879
879
  anchorXUnits: 'pixels',
880
880
  anchorYUnits: 'pixels',
881
- src: drawParam.parameter.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
881
+ src: drawParam.parameter.url || require("../images/defaultMarker.png"),
882
882
  opacity: 1,
883
883
  scale: drawParam.parameter.scale || 1
884
884
  })
@@ -893,7 +893,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
893
893
  anchor: [-drawParam.parameter.markerContentX || -15, -drawParam.parameter.markerContentY || -15],
894
894
  anchorXUnits: 'pixels',
895
895
  anchorYUnits: 'pixels',
896
- src: drawParam.parameter.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
896
+ src: drawParam.parameter.url || require("../images/defaultMarker.png"),
897
897
  opacity: 1,
898
898
  scale: drawParam.parameter.scale || 1
899
899
  })
@@ -973,7 +973,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
973
973
  id: t.drawParam.data.id,
974
974
  longitude: lng,
975
975
  latitude: lat,
976
- url: t.drawParam.parameter.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
976
+ url: t.drawParam.parameter.url || require("../images/defaultMarker.png"),
977
977
  config: _objectSpread({}, t.drawParam.parameter)
978
978
  }], 'point'); //处理点返回参数
979
979
 
@@ -981,7 +981,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
981
981
  id: t.drawParam.data.id,
982
982
  attributes: {
983
983
  id: t.drawParam.data.id,
984
- url: t.drawParam.parameter.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
984
+ url: t.drawParam.parameter.url || require("../images/defaultMarker.png"),
985
985
  config: {
986
986
  width: t.drawParam.parameter.width || 30,
987
987
  height: t.drawParam.parameter.height || 30
@@ -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,
@@ -1819,7 +1825,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1819
1825
  });
1820
1826
  t.state.gis.addOverlay(pop);
1821
1827
  } else {
1822
- // item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
1828
+ // item.url || require("../images/defaultMarker.png"),
1823
1829
  canvasDataURL(item.url || require("../images/defaultMarker.png"), {
1824
1830
  width: cg.width,
1825
1831
  height: cg.height
@@ -1883,7 +1889,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1883
1889
  anchor: [-cg.markerContentX, -cg.markerContentY],
1884
1890
  anchorXUnits: 'pixels',
1885
1891
  anchorYUnits: 'pixels',
1886
- // src: item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
1892
+ // src: item.url || require("../images/defaultMarker.png"),
1887
1893
  img: myImage,
1888
1894
  imgSize: [cg.width, cg.height],
1889
1895
  opacity: cg.opacity,
@@ -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();
@@ -1999,7 +2010,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1999
2010
  anchor: [-cg.markerContentX, -cg.markerContentY],
2000
2011
  anchorXUnits: 'pixels',
2001
2012
  anchorYUnits: 'pixels',
2002
- // src: item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
2013
+ // src: item.url || require("../images/defaultMarker.png"),
2003
2014
  img: myImage,
2004
2015
  imgSize: [cg.width, cg.height],
2005
2016
  opacity: cg.opacity,
@@ -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
  }
@@ -4197,7 +4213,7 @@ var Popup = /*#__PURE__*/function (_React$Component2) {
4197
4213
  function getRgbColor(color, opacity) {
4198
4214
  var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
4199
4215
 
4200
- if (!reg.test(color)) {
4216
+ if (!reg.test(color) && typeof color !== 'string') {
4201
4217
  return;
4202
4218
  }
4203
4219