@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.
@@ -2020,6 +2020,20 @@ var BaiduMap = /*#__PURE__*/function (_React$Component) {
2020
2020
  return t.state.gis.getViewport(allLayers);
2021
2021
  }
2022
2022
  }
2023
+ } // 设置最佳视野
2024
+
2025
+ }, {
2026
+ key: "fitView",
2027
+ value: function fitView() {
2028
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2029
+ var t = this;
2030
+
2031
+ if ((arr === null || arr === void 0 ? void 0 : arr.length) > 0) {
2032
+ var obj = t.state.gis.getViewport(arr.map(function (item) {
2033
+ return new BMap.Point(item[0], item[1]);
2034
+ }));
2035
+ t.state.gis.centerAndZoom(obj.center, obj.zoom);
2036
+ }
2023
2037
  } //获取图元数据
2024
2038
 
2025
2039
  }, {
@@ -3750,6 +3764,10 @@ var BaiduMap = /*#__PURE__*/function (_React$Component) {
3750
3764
  t.setCenter(gt);
3751
3765
  };
3752
3766
 
3767
+ t.state.gis["fitView"] = function (arr) {
3768
+ t.fitView(arr);
3769
+ };
3770
+
3753
3771
  t.state.gis["getZoomLevel"] = function () {
3754
3772
  return t.getZoomLevel();
3755
3773
  };