ry-vue-mapv3 0.0.6 → 0.0.8

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.
package/dist/index.js CHANGED
@@ -903,10 +903,31 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
903
903
  const RyMapTool = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-dfd4cfff"]]);
904
904
  function ryMapHook(props) {
905
905
  let map = null;
906
+ let _services;
906
907
  vue.watch(
907
908
  () => props.center,
909
+ (val) => {
910
+ if (_services && val.length == 2) {
911
+ _services.setCenter(val);
912
+ }
913
+ },
914
+ { deep: true }
915
+ );
916
+ vue.watch(
917
+ () => props.bboxRange,
918
+ (val) => {
919
+ console.log("val===", val);
920
+ if (_services && val.length) {
921
+ _services.setBBOXRange(val);
922
+ }
923
+ },
924
+ { deep: true }
925
+ );
926
+ vue.watch(
927
+ () => props.bbox,
908
928
  (val) => {
909
929
  console.log("val===", val);
930
+ setFit(val);
910
931
  },
911
932
  { deep: true }
912
933
  );
@@ -932,7 +953,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
932
953
  viewOptions: getViewOptions(),
933
954
  callback: (_map, layers) => {
934
955
  map = _map;
935
- setFit(props.bbox);
956
+ _services = lMap;
957
+ if (props.bboxRange.length) {
958
+ lMap.setBBOXRange(props.bbox);
959
+ }
960
+ if (props && props.bbox.length) {
961
+ setFit(props.bbox);
962
+ }
936
963
  callback({
937
964
  map,
938
965
  mapServices: lMap,
@@ -18337,6 +18364,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
18337
18364
  get DrawZIndex() {
18338
18365
  return this.drawZIndex;
18339
18366
  }
18367
+ setBBOXRange(number) {
18368
+ if (number.length === 1) {
18369
+ this.setCenter(number[0], 15);
18370
+ return;
18371
+ }
18372
+ const am = new ryMapts.AM();
18373
+ number.forEach((val) => {
18374
+ const [X, Y] = val;
18375
+ am.getLngAndLatMaxMin({
18376
+ X,
18377
+ Y
18378
+ });
18379
+ });
18380
+ const [x1, y1, x2, y2] = am.getLngLats();
18381
+ if (!x1[0] || !y1[0] || x2[0] === 400 || y2[0] === 400) return;
18382
+ this.fit([
18383
+ [x1, y1],
18384
+ [x2, y2]
18385
+ ]);
18386
+ }
18340
18387
  }
18341
18388
  let MapDto$1 = class MapDto {
18342
18389
  constructor() {
@@ -18471,6 +18518,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
18471
18518
  type: Number,
18472
18519
  default: 17
18473
18520
  });
18521
+ // bbox范围
18522
+ __publicField(this, "bboxRange", {
18523
+ type: Array,
18524
+ default: []
18525
+ });
18474
18526
  }
18475
18527
  };
18476
18528
  class MapDto {
package/dist/index.mjs CHANGED
@@ -902,10 +902,31 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
902
902
  const RyMapTool = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-dfd4cfff"]]);
903
903
  function ryMapHook(props) {
904
904
  let map = null;
905
+ let _services;
905
906
  watch(
906
907
  () => props.center,
908
+ (val) => {
909
+ if (_services && val.length == 2) {
910
+ _services.setCenter(val);
911
+ }
912
+ },
913
+ { deep: true }
914
+ );
915
+ watch(
916
+ () => props.bboxRange,
917
+ (val) => {
918
+ console.log("val===", val);
919
+ if (_services && val.length) {
920
+ _services.setBBOXRange(val);
921
+ }
922
+ },
923
+ { deep: true }
924
+ );
925
+ watch(
926
+ () => props.bbox,
907
927
  (val) => {
908
928
  console.log("val===", val);
929
+ setFit(val);
909
930
  },
910
931
  { deep: true }
911
932
  );
@@ -931,7 +952,13 @@ function ryMapHook(props) {
931
952
  viewOptions: getViewOptions(),
932
953
  callback: (_map, layers) => {
933
954
  map = _map;
934
- setFit(props.bbox);
955
+ _services = lMap;
956
+ if (props.bboxRange.length) {
957
+ lMap.setBBOXRange(props.bbox);
958
+ }
959
+ if (props && props.bbox.length) {
960
+ setFit(props.bbox);
961
+ }
935
962
  callback({
936
963
  map,
937
964
  mapServices: lMap,
@@ -18336,6 +18363,26 @@ class LMapServices {
18336
18363
  get DrawZIndex() {
18337
18364
  return this.drawZIndex;
18338
18365
  }
18366
+ setBBOXRange(number) {
18367
+ if (number.length === 1) {
18368
+ this.setCenter(number[0], 15);
18369
+ return;
18370
+ }
18371
+ const am = new AM();
18372
+ number.forEach((val) => {
18373
+ const [X, Y] = val;
18374
+ am.getLngAndLatMaxMin({
18375
+ X,
18376
+ Y
18377
+ });
18378
+ });
18379
+ const [x1, y1, x2, y2] = am.getLngLats();
18380
+ if (!x1[0] || !y1[0] || x2[0] === 400 || y2[0] === 400) return;
18381
+ this.fit([
18382
+ [x1, y1],
18383
+ [x2, y2]
18384
+ ]);
18385
+ }
18339
18386
  }
18340
18387
  let MapDto$1 = class MapDto {
18341
18388
  constructor() {
@@ -18470,6 +18517,11 @@ let MapDto$1 = class MapDto {
18470
18517
  type: Number,
18471
18518
  default: 17
18472
18519
  });
18520
+ // bbox范围
18521
+ __publicField(this, "bboxRange", {
18522
+ type: Array,
18523
+ default: []
18524
+ });
18473
18525
  }
18474
18526
  };
18475
18527
  class MapDto2 {
@@ -76,4 +76,8 @@ export default class MapDto {
76
76
  type: NumberConstructor;
77
77
  default: number;
78
78
  };
79
+ bboxRange: {
80
+ type: ArrayConstructor;
81
+ default: never[];
82
+ };
79
83
  }
@@ -728,6 +728,10 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
728
728
  type: NumberConstructor;
729
729
  default: number;
730
730
  };
731
+ bboxRange: {
732
+ type: ArrayConstructor;
733
+ default: never[];
734
+ };
731
735
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
732
736
  changeSwitchMap: (...args: any[]) => void;
733
737
  loadDrawPolygonEvent: (...args: any[]) => void;
@@ -924,6 +928,10 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
924
928
  type: NumberConstructor;
925
929
  default: number;
926
930
  };
931
+ bboxRange: {
932
+ type: ArrayConstructor;
933
+ default: never[];
934
+ };
927
935
  }>> & Readonly<{
928
936
  onChangeSwitchMap?: ((...args: any[]) => any) | undefined;
929
937
  onLoadDrawPolygonEvent?: ((...args: any[]) => any) | undefined;
@@ -982,6 +990,7 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
982
990
  isShowSwitchMap: boolean;
983
991
  resolution: boolean;
984
992
  zoomedIn: number;
993
+ bboxRange: unknown[];
985
994
  }, {}, {}, {}, string, ComponentProvideOptions, true, {
986
995
  mapTool: ({
987
996
  $: ComponentInternalInstance;
@@ -146,4 +146,5 @@ export default class LMapServices {
146
146
  }): Promise<void>;
147
147
  set DrawZIndex(zIndex: number);
148
148
  get DrawZIndex(): number;
149
+ setBBOXRange(number: [][]): void;
149
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ry-vue-mapv3",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -36,7 +36,7 @@
36
36
  "@vue/tsconfig": "^0.9.1",
37
37
  "element-plus": "^2.9.1",
38
38
  "ol": "^10.0.0",
39
- "ry-mapts": "^0.0.6",
39
+ "ry-mapts": "^0.0.7",
40
40
  "sass-embedded": "^1.83.0",
41
41
  "terser": "5.31.6",
42
42
  "typescript": "^5.7.2",