@heycar/heycars-map 0.5.5 → 0.5.6

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.
@@ -0,0 +1,10 @@
1
+ import type { Point } from "../types/interface";
2
+ interface UseDrivingTrackCorrectionProps {
3
+ track: Point[];
4
+ path: Point[];
5
+ onDeviation: (point: Point) => any;
6
+ }
7
+ export declare const useDrivingTrackCorrection: (props: UseDrivingTrackCorrectionProps) => {
8
+ path: import("vue").Ref<[number, number][]>;
9
+ };
10
+ export {};
@@ -1,10 +1,13 @@
1
1
  import type { Point } from "../types/interface";
2
2
  export declare const useAmapGeometry: () => {
3
3
  apiMapDistance: (from: Point, to: Point) => number | undefined;
4
+ apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
4
5
  };
5
6
  export declare const useGmapGeometry: () => {
6
7
  apiMapDistance: (from: Point, to: Point) => number | undefined;
8
+ apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
7
9
  };
8
10
  export declare const useMapGeometry: () => {
9
11
  apiMapDistance: (from: Point, to: Point) => number | undefined;
12
+ apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
10
13
  };
package/dist/index.cjs CHANGED
@@ -2549,11 +2549,20 @@ const useAmapFitView = (props) => {
2549
2549
  },
2550
2550
  setFitView
2551
2551
  };
2552
- const handleMoveEndOrZomEnd = () => {
2552
+ const handleDraggingOrZoomChange = () => {
2553
+ if (!autoFitTimeout || !timer)
2554
+ return;
2555
+ clearTimeout(timer);
2556
+ timer = void 0;
2557
+ };
2558
+ const handleMoveEndOrZomEnd = (eventName) => {
2559
+ spaceLog("useAmapFitViewHandleMoveEndOrZomEnd", "eventName = ", eventName);
2553
2560
  if (!autoFitTimeout)
2554
2561
  return;
2555
- if (timer)
2562
+ if (timer) {
2556
2563
  clearTimeout(timer);
2564
+ timer = void 0;
2565
+ }
2557
2566
  timer = setTimeout(() => {
2558
2567
  timer = void 0;
2559
2568
  setFitView();
@@ -2563,7 +2572,13 @@ const useAmapFitView = (props) => {
2563
2572
  mapRef,
2564
2573
  {},
2565
2574
  handleMoveEndOrZomEnd,
2566
- ["onDragEnd"]
2575
+ ["onDragEnd", "onZoomEnd"]
2576
+ );
2577
+ watchPostEffectForAMapEvent(
2578
+ mapRef,
2579
+ {},
2580
+ handleDraggingOrZoomChange,
2581
+ ["onDragging", "onZoomchange"]
2567
2582
  );
2568
2583
  return { registerFitVeiw, setFitView };
2569
2584
  };
@@ -2608,6 +2623,12 @@ const useGmapFitView = (props) => {
2608
2623
  },
2609
2624
  setFitView
2610
2625
  };
2626
+ const handleDrag = () => {
2627
+ if (!autoFitTimeout || !timer)
2628
+ return;
2629
+ clearTimeout(timer);
2630
+ timer = void 0;
2631
+ };
2611
2632
  const handleMoveEnd = () => {
2612
2633
  const eventSource = getMapEvnetSource();
2613
2634
  if (!autoFitTimeout || eventSource !== "user")
@@ -2626,6 +2647,9 @@ const useGmapFitView = (props) => {
2626
2647
  watchPostEffectForGMapEvent(mapRef, {}, handleZoomChange, [
2627
2648
  "onZoom_changed"
2628
2649
  ]);
2650
+ watchPostEffectForGMapEvent(mapRef, {}, handleDrag, [
2651
+ "onDrag"
2652
+ ]);
2629
2653
  return { registerFitVeiw, setFitView };
2630
2654
  };
2631
2655
  const useMapFitView = (props) => {
@@ -4088,7 +4112,12 @@ const useAmapGeometry = () => {
4088
4112
  return void 0;
4089
4113
  return AMap.GeometryUtil.distance(from, to);
4090
4114
  };
4091
- return { apiMapDistance };
4115
+ const apiMapDistanceToLine = (from, line) => {
4116
+ if (payload.status !== Status.SUCCESS)
4117
+ return void 0;
4118
+ return AMap.GeometryUtil.distanceToLine(from, line);
4119
+ };
4120
+ return { apiMapDistance, apiMapDistanceToLine };
4092
4121
  };
4093
4122
  const useGmapGeometry = () => {
4094
4123
  const payload = useMapSupplier();
@@ -4097,7 +4126,12 @@ const useGmapGeometry = () => {
4097
4126
  return void 0;
4098
4127
  return google.maps.geometry.spherical.computeDistanceBetween(vec2lnglat(from), vec2lnglat(to));
4099
4128
  };
4100
- return { apiMapDistance };
4129
+ const apiMapDistanceToLine = (from, line) => {
4130
+ if (payload.status !== Status.SUCCESS)
4131
+ return void 0;
4132
+ return 0;
4133
+ };
4134
+ return { apiMapDistance, apiMapDistanceToLine };
4101
4135
  };
4102
4136
  const useMapGeometry = () => {
4103
4137
  const { supplier } = useMapSupplier();
package/dist/index.js CHANGED
@@ -2547,11 +2547,20 @@ const useAmapFitView = (props) => {
2547
2547
  },
2548
2548
  setFitView
2549
2549
  };
2550
- const handleMoveEndOrZomEnd = () => {
2550
+ const handleDraggingOrZoomChange = () => {
2551
+ if (!autoFitTimeout || !timer)
2552
+ return;
2553
+ clearTimeout(timer);
2554
+ timer = void 0;
2555
+ };
2556
+ const handleMoveEndOrZomEnd = (eventName) => {
2557
+ spaceLog("useAmapFitViewHandleMoveEndOrZomEnd", "eventName = ", eventName);
2551
2558
  if (!autoFitTimeout)
2552
2559
  return;
2553
- if (timer)
2560
+ if (timer) {
2554
2561
  clearTimeout(timer);
2562
+ timer = void 0;
2563
+ }
2555
2564
  timer = setTimeout(() => {
2556
2565
  timer = void 0;
2557
2566
  setFitView();
@@ -2561,7 +2570,13 @@ const useAmapFitView = (props) => {
2561
2570
  mapRef,
2562
2571
  {},
2563
2572
  handleMoveEndOrZomEnd,
2564
- ["onDragEnd"]
2573
+ ["onDragEnd", "onZoomEnd"]
2574
+ );
2575
+ watchPostEffectForAMapEvent(
2576
+ mapRef,
2577
+ {},
2578
+ handleDraggingOrZoomChange,
2579
+ ["onDragging", "onZoomchange"]
2565
2580
  );
2566
2581
  return { registerFitVeiw, setFitView };
2567
2582
  };
@@ -2606,6 +2621,12 @@ const useGmapFitView = (props) => {
2606
2621
  },
2607
2622
  setFitView
2608
2623
  };
2624
+ const handleDrag = () => {
2625
+ if (!autoFitTimeout || !timer)
2626
+ return;
2627
+ clearTimeout(timer);
2628
+ timer = void 0;
2629
+ };
2609
2630
  const handleMoveEnd = () => {
2610
2631
  const eventSource = getMapEvnetSource();
2611
2632
  if (!autoFitTimeout || eventSource !== "user")
@@ -2624,6 +2645,9 @@ const useGmapFitView = (props) => {
2624
2645
  watchPostEffectForGMapEvent(mapRef, {}, handleZoomChange, [
2625
2646
  "onZoom_changed"
2626
2647
  ]);
2648
+ watchPostEffectForGMapEvent(mapRef, {}, handleDrag, [
2649
+ "onDrag"
2650
+ ]);
2627
2651
  return { registerFitVeiw, setFitView };
2628
2652
  };
2629
2653
  const useMapFitView = (props) => {
@@ -4086,7 +4110,12 @@ const useAmapGeometry = () => {
4086
4110
  return void 0;
4087
4111
  return AMap.GeometryUtil.distance(from, to);
4088
4112
  };
4089
- return { apiMapDistance };
4113
+ const apiMapDistanceToLine = (from, line) => {
4114
+ if (payload.status !== Status.SUCCESS)
4115
+ return void 0;
4116
+ return AMap.GeometryUtil.distanceToLine(from, line);
4117
+ };
4118
+ return { apiMapDistance, apiMapDistanceToLine };
4090
4119
  };
4091
4120
  const useGmapGeometry = () => {
4092
4121
  const payload = useMapSupplier();
@@ -4095,7 +4124,12 @@ const useGmapGeometry = () => {
4095
4124
  return void 0;
4096
4125
  return google.maps.geometry.spherical.computeDistanceBetween(vec2lnglat(from), vec2lnglat(to));
4097
4126
  };
4098
- return { apiMapDistance };
4127
+ const apiMapDistanceToLine = (from, line) => {
4128
+ if (payload.status !== Status.SUCCESS)
4129
+ return void 0;
4130
+ return 0;
4131
+ };
4132
+ return { apiMapDistance, apiMapDistanceToLine };
4099
4133
  };
4100
4134
  const useMapGeometry = () => {
4101
4135
  const { supplier } = useMapSupplier();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",