@vtx/map 1.1.30 → 1.1.31

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.
@@ -734,6 +734,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
734
734
  return t.clearFrameSelect();
735
735
  };
736
736
 
737
+ t.state.gis["clearFrameSelectById"] = function (id) {
738
+ return t.clearFrameSelectById(id);
739
+ };
740
+
737
741
  t.state.gis["refresh"] = function () {
738
742
  t.refresh();
739
743
  };
@@ -1167,7 +1171,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1167
1171
  }
1168
1172
 
1169
1173
  t.drawToolbar.on('drawend', function (e) {
1170
- var _t$frameSelectProps;
1174
+ var _t$frameSelectProps$p;
1171
1175
 
1172
1176
  // 关闭绘制事件
1173
1177
  t.drawToolbar.finishDrawing(); // 移除
@@ -1412,8 +1416,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1412
1416
  t.props.drawEnd(param);
1413
1417
  }
1414
1418
 
1415
- if (((_t$frameSelectProps = t.frameSelectProps) === null || _t$frameSelectProps === void 0 ? void 0 : _t$frameSelectProps.callback) instanceof Function) {
1416
- t.frameSelectProps.callback(param);
1419
+ if (((_t$frameSelectProps$p = t.frameSelectProps[param.attributes.id]) === null || _t$frameSelectProps$p === void 0 ? void 0 : _t$frameSelectProps$p.callback) instanceof Function) {
1420
+ t.frameSelectProps[param.attributes.id].callback(param);
1417
1421
  }
1418
1422
  }); //保存绘制图元的id便于后期比对
1419
1423
 
@@ -2006,7 +2010,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2006
2010
  var t = this;
2007
2011
  var params = {},
2008
2012
  type = geometryType || 'polygon',
2009
- id = data.id || 'frameSelectFeature';
2013
+ id = data.id || "frameSelectFeature_".concat(Math.random());
2010
2014
  params.color = parameter.color || '#FF0000';
2011
2015
  params.lineColor = parameter.lineColor || '#FF0000';
2012
2016
  params.lineOpacity = parameter.lineOpacity || 1;
@@ -2020,7 +2024,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2020
2024
  id: id
2021
2025
  }
2022
2026
  });
2023
- t.frameSelectProps = {
2027
+ t.frameSelectProps[id] = {
2024
2028
  callback: callback,
2025
2029
  id: id,
2026
2030
  type: geometryType
@@ -2030,8 +2034,19 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2030
2034
  }, {
2031
2035
  key: "clearFrameSelect",
2032
2036
  value: function clearFrameSelect() {
2033
- this.removeGraphic(this.frameSelectProps.id, this.frameSelectProps.type);
2037
+ for (var key in this.frameSelectProps) {
2038
+ this.removeGraphic(this.frameSelectProps[key].id, this.frameSelectProps[key].type);
2039
+ }
2040
+
2034
2041
  this.frameSelectProps = {};
2042
+ } // 清除框选ById
2043
+
2044
+ }, {
2045
+ key: "clearFrameSelectById",
2046
+ value: function clearFrameSelectById(id) {
2047
+ var obj = this.frameSelectProps[id];
2048
+ this.removeGraphic(obj.id, obj.type);
2049
+ delete this.frameSelectProps[id];
2035
2050
  }
2036
2051
  /*
2037
2052
  * 添加信息窗口