@fleet-frontend/mower-maps 0.1.0-beta.2 → 0.1.0-beta.4

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.esm.js CHANGED
@@ -11966,7 +11966,7 @@ const MowerMapRenderer = forwardRef(({ edger = false, unitType = UnitsType.Imper
11966
11966
  setCurrentError(error);
11967
11967
  onError?.(error);
11968
11968
  };
11969
- const fitBounds = useCallback(() => {
11969
+ const fitBounds = useCallback((padding = 0) => {
11970
11970
  if (!mapJson || !mapRef)
11971
11971
  return null;
11972
11972
  // 计算边界
@@ -11985,7 +11985,7 @@ const MowerMapRenderer = forwardRef(({ edger = false, unitType = UnitsType.Imper
11985
11985
  const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
11986
11986
  new window.google.maps.LatLng(neLat, neLng) // 东北角
11987
11987
  );
11988
- mapRef.fitBounds(googleBounds);
11988
+ mapRef.fitBounds(googleBounds, padding);
11989
11989
  }, [mapJson, mapRef, defaultTransform]);
11990
11990
  // 初始化Google Maps叠加层
11991
11991
  const initializeGoogleMapsOverlay = async () => {
@@ -12039,7 +12039,7 @@ const MowerMapRenderer = forwardRef(({ edger = false, unitType = UnitsType.Imper
12039
12039
  overlay.setEdger(edger);
12040
12040
  // 只在首次初始化时自适应视图
12041
12041
  if (!hasInitializedBounds) {
12042
- mapInstance.fitBounds(googleBounds);
12042
+ // mapInstance.fitBounds(googleBounds);
12043
12043
  setHasInitializedBounds(true);
12044
12044
  }
12045
12045
  setIsGoogleMapsReady(true);
@@ -12339,16 +12339,6 @@ const MowerMapRenderer = forwardRef(({ edger = false, unitType = UnitsType.Imper
12339
12339
  if (!overlayRef.current || !defaultTransform)
12340
12340
  return;
12341
12341
  overlayRef.current?.setTransform(defaultTransform);
12342
- const validBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
12343
- // 地图数据中的坐标格式是 [longitude, latitude]
12344
- const swLat = validBounds.sw[1] + defaultTransform.y;
12345
- const swLng = validBounds.sw[0] + defaultTransform.x;
12346
- const neLat = validBounds.ne[1] + defaultTransform.y;
12347
- const neLng = validBounds.ne[0] + defaultTransform.x;
12348
- const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
12349
- new window.google.maps.LatLng(neLat, neLng) // 东北角
12350
- );
12351
- mapRef.fitBounds(googleBounds);
12352
12342
  }, [defaultTransform]);
12353
12343
  useEffect(() => {
12354
12344
  if (!overlayRef || !overlayRef.current)
@@ -12357,8 +12347,8 @@ const MowerMapRenderer = forwardRef(({ edger = false, unitType = UnitsType.Imper
12357
12347
  }, [edger]);
12358
12348
  // 提供ref方法
12359
12349
  useImperativeHandle(ref, () => ({
12360
- fitToView: () => {
12361
- fitBounds();
12350
+ fitToView: (padding = 0) => {
12351
+ fitBounds(padding);
12362
12352
  },
12363
12353
  getOverlay: () => {
12364
12354
  return overlayRef.current;
package/dist/index.js CHANGED
@@ -11968,7 +11968,7 @@ const MowerMapRenderer = React.forwardRef(({ edger = false, unitType = UnitsType
11968
11968
  setCurrentError(error);
11969
11969
  onError?.(error);
11970
11970
  };
11971
- const fitBounds = React.useCallback(() => {
11971
+ const fitBounds = React.useCallback((padding = 0) => {
11972
11972
  if (!mapJson || !mapRef)
11973
11973
  return null;
11974
11974
  // 计算边界
@@ -11987,7 +11987,7 @@ const MowerMapRenderer = React.forwardRef(({ edger = false, unitType = UnitsType
11987
11987
  const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
11988
11988
  new window.google.maps.LatLng(neLat, neLng) // 东北角
11989
11989
  );
11990
- mapRef.fitBounds(googleBounds);
11990
+ mapRef.fitBounds(googleBounds, padding);
11991
11991
  }, [mapJson, mapRef, defaultTransform]);
11992
11992
  // 初始化Google Maps叠加层
11993
11993
  const initializeGoogleMapsOverlay = async () => {
@@ -12041,7 +12041,7 @@ const MowerMapRenderer = React.forwardRef(({ edger = false, unitType = UnitsType
12041
12041
  overlay.setEdger(edger);
12042
12042
  // 只在首次初始化时自适应视图
12043
12043
  if (!hasInitializedBounds) {
12044
- mapInstance.fitBounds(googleBounds);
12044
+ // mapInstance.fitBounds(googleBounds);
12045
12045
  setHasInitializedBounds(true);
12046
12046
  }
12047
12047
  setIsGoogleMapsReady(true);
@@ -12341,16 +12341,6 @@ const MowerMapRenderer = React.forwardRef(({ edger = false, unitType = UnitsType
12341
12341
  if (!overlayRef.current || !defaultTransform)
12342
12342
  return;
12343
12343
  overlayRef.current?.setTransform(defaultTransform);
12344
- const validBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
12345
- // 地图数据中的坐标格式是 [longitude, latitude]
12346
- const swLat = validBounds.sw[1] + defaultTransform.y;
12347
- const swLng = validBounds.sw[0] + defaultTransform.x;
12348
- const neLat = validBounds.ne[1] + defaultTransform.y;
12349
- const neLng = validBounds.ne[0] + defaultTransform.x;
12350
- const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
12351
- new window.google.maps.LatLng(neLat, neLng) // 东北角
12352
- );
12353
- mapRef.fitBounds(googleBounds);
12354
12344
  }, [defaultTransform]);
12355
12345
  React.useEffect(() => {
12356
12346
  if (!overlayRef || !overlayRef.current)
@@ -12359,8 +12349,8 @@ const MowerMapRenderer = React.forwardRef(({ edger = false, unitType = UnitsType
12359
12349
  }, [edger]);
12360
12350
  // 提供ref方法
12361
12351
  React.useImperativeHandle(ref, () => ({
12362
- fitToView: () => {
12363
- fitBounds();
12352
+ fitToView: (padding = 0) => {
12353
+ fitBounds(padding);
12364
12354
  },
12365
12355
  getOverlay: () => {
12366
12356
  return overlayRef.current;
@@ -1 +1 @@
1
- {"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AA6Cf,OAAO,EAAa,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAO1F,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,GAAG,CAAC;KACb;CACF;AAgGD,eAAO,MAAM,gBAAgB,mGA8tB5B,CAAC;AAIF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AA6Cf,OAAO,EAAa,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAO1F,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,GAAG,CAAC;KACb;CACF;AAgGD,eAAO,MAAM,gBAAgB,mGAitB5B,CAAC;AAIF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleet-frontend/mower-maps",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.4",
4
4
  "type": "module",
5
5
  "description": "a mower maps in google maps",
6
6
  "main": "dist/index.js",