@vtx/map 1.1.54 → 1.2.2

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.
@@ -812,6 +812,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
812
812
  value: function initPropsForUser() {
813
813
  var t = this;
814
814
 
815
+ t.state.gis["fitView"] = function (arr) {
816
+ t.fitView(arr);
817
+ };
818
+
815
819
  t.state.gis["getCenter"] = function () {
816
820
  return t.getCenter();
817
821
  };
@@ -1887,6 +1891,18 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1887
1891
  var bounds = [minX, minY, maxX, maxY];
1888
1892
  return bounds;
1889
1893
  }
1894
+ } // 设置最佳视野
1895
+
1896
+ }, {
1897
+ key: "fitView",
1898
+ value: function fitView() {
1899
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1900
+ var t = this;
1901
+
1902
+ if ((arr === null || arr === void 0 ? void 0 : arr.length) > 0) {
1903
+ var displayRange = new ol.extent.boundingExtent(arr);
1904
+ t.state.gis.getView().fit(displayRange, t.state.gis.getSize());
1905
+ }
1890
1906
  }
1891
1907
  /*功能方法*/
1892
1908
  //获取当前地图的中心位置
@@ -4654,6 +4670,13 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
4654
4670
  };
4655
4671
  t.props.clickGraphic(obj);
4656
4672
  }
4673
+ } // 地图重新渲染大小
4674
+
4675
+ }, {
4676
+ key: "updateSize",
4677
+ value: function updateSize() {
4678
+ var t = this;
4679
+ t.state.gis.updateSize();
4657
4680
  }
4658
4681
  }, {
4659
4682
  key: "componentWillUnmount",