@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.
@@ -387,6 +387,10 @@ var TMap = /*#__PURE__*/function (_React$Component) {
387
387
  value: function initPropsForUser() {
388
388
  var t = this;
389
389
 
390
+ t.state.gis["fitView"] = function (arr) {
391
+ t.fitView(arr);
392
+ };
393
+
390
394
  t.state.gis["frameSelect"] = function () {
391
395
  var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
392
396
  var callback = arguments.length > 1 ? arguments[1] : undefined;
@@ -666,6 +670,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
666
670
  t.state.gis.centerAndZoom(center, zoom);
667
671
  }
668
672
  }
673
+ } // 设置最佳视野
674
+
675
+ }, {
676
+ key: "fitView",
677
+ value: function fitView() {
678
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
679
+ var t = this;
680
+
681
+ if ((arr === null || arr === void 0 ? void 0 : arr.length) > 0) {
682
+ t.state.gis.setViewport(arr.map(function (item) {
683
+ return new T.LngLat(item[0], item[1]);
684
+ }));
685
+ }
669
686
  } //设置地图比例尺
670
687
 
671
688
  }, {