@heycar/heycars-map 0.2.3 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",
@@ -13,6 +13,8 @@ import type { Point } from "../../types/interface";
13
13
  export type DrivingRouteRenderProps = {
14
14
  path: Point[];
15
15
  angle?: number;
16
+ distance: number;
17
+ duration: number;
16
18
  };
17
19
  export interface DrivingRouteProps extends UseDrivingRouteProps {
18
20
  render?: (props: DrivingRouteRenderProps) => VNodeChild;
@@ -4,7 +4,7 @@ import { AmapMarker } from "../../components/AmapMarker";
4
4
  import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView";
5
5
  import { useMapSupplier } from "../../hooks/useMapSupplier";
6
6
  import { AnchorType } from "../../types/amap/marker";
7
- import { createElement, defineSetup } from "../../types/helper";
7
+ import { createElement, defineLagecySetup, defineSetup } from "../../types/helper";
8
8
  import { createDom } from "../../utils/dom";
9
9
  import { vec2lnglat } from "../../utils/transform";
10
10
  import * as css from "./PlaceCircle.css";
@@ -15,7 +15,7 @@ export interface PlaceCircleProps {
15
15
  textAlign?: "left" | "right";
16
16
  hideIcon?: boolean;
17
17
  }
18
- export const APlaceCircle = defineSetup(function APlaceCircle(props: PlaceCircleProps) {
18
+ export const APlaceCircle = defineLagecySetup(function APlaceCircle(props: PlaceCircleProps) {
19
19
  const textAlignRef = computed(() => props.textAlign ?? "right");
20
20
  const contentRef = computed(() => {
21
21
  const { hideIcon = false } = props;
@@ -41,9 +41,9 @@ export const APlaceCircle = defineSetup(function APlaceCircle(props: PlaceCircle
41
41
  anchor={textAlignRef.value === "left" ? AnchorType.middleRight : AnchorType.middleLeft}
42
42
  />
43
43
  );
44
- });
44
+ }).props(["hideIcon", "label", "position", "textAlign"]);
45
45
 
46
- export const GPlaceCircle = defineSetup(function GPlaceCircle(props: PlaceCircleProps) {
46
+ export const GPlaceCircle = defineLagecySetup(function GPlaceCircle(props: PlaceCircleProps) {
47
47
  const textAlignRef = computed(() => props.textAlign ?? "right");
48
48
  const contentRef = computed(() => {
49
49
  const { hideIcon = false } = props;
@@ -75,7 +75,7 @@ export const GPlaceCircle = defineSetup(function GPlaceCircle(props: PlaceCircle
75
75
  content={props.label ? contentRef.value : contentWithoutLabelRef.value}
76
76
  />
77
77
  );
78
- });
78
+ }).props(["hideIcon", "label", "position", "textAlign"]);
79
79
 
80
80
  export const PlaceCircle = defineSetup(function PlaceCircle(props: PlaceCircleProps) {
81
81
  const payload = useMapSupplier();
@@ -1,7 +1,8 @@
1
1
  import { computed } from "vue-demi";
2
+ import { DrivingLine } from "../../business-components/DrivingLine";
3
+ import { DrivingRoute } from "../../business-components/DrivingRoute";
2
4
  import { PlaceCircle } from "../../business-components/PlaceCircle";
3
- import { WalkingLine } from "../../business-components/WalkingLine";
4
- import { WalkingRoute } from "../../business-components/WalkingRoute";
5
+ import { TaxiCar } from "../../business-components/TaxiCar";
5
6
  import { useBusinessMapAutoComplete } from "../../hooks-business/useBusinessMapAutoComplete";
6
7
  import {
7
8
  useBusinessMapRecomendPlace,
@@ -26,7 +27,7 @@ export const HeycarDemo = defineSetup(function HeycarDemo() {
26
27
  amapSecret={amapApiSecret}
27
28
  gmapId={gmapId}
28
29
  gmapKey={gmapApiKey}
29
- supplier={"amap"}
30
+ supplier={"gmap"}
30
31
  >
31
32
  <SomeHomePage />
32
33
  </MapProvider>
@@ -149,21 +150,21 @@ export const SomeHomePage = defineSetup(function SomeHomePage() {
149
150
  ]}
150
151
  labels={["place name 1", "place name 2"]}
151
152
  /> */}
152
- {/* <DrivingRoute
153
+ <DrivingRoute
153
154
  from={[121, 31]}
154
155
  to={[121.6, 31.3]}
155
156
  render={({ path, angle }) => [
156
157
  <DrivingLine path={path} />,
157
158
  <TaxiCar position={[121, 31]} angle={angle} />,
158
159
  ]}
159
- /> */}
160
+ />
160
161
  {/* <PassengerCircle position={centerPoint.value} size="small" /> */}
161
162
  <PlaceCircle position={centerPoint.value} label={"some place"} hideIcon />
162
- <WalkingRoute
163
+ {/* <WalkingRoute
163
164
  from={centerPoint.value}
164
165
  to={[centerPoint.value[0] + 0.01, centerPoint.value[1] + 0.01]}
165
166
  render={({ path }) => <WalkingLine path={path} />}
166
- />
167
+ /> */}
167
168
  </HeycarMap>
168
169
  </div>
169
170
  );
@@ -69,13 +69,11 @@ export const useGDrivingRoute = (props: UseDrivingRouteProps) => {
69
69
  let distance = 0;
70
70
  let duration = 0;
71
71
  const firstRoute = result!.routes[0];
72
-
73
72
  const stepPath = firstRoute.overview_path.map<Point>((item) => [
74
73
  item.lng(),
75
74
  item.lat(),
76
75
  ]);
77
76
  path = path.concat(stepPath);
78
-
79
77
  for (const leg of firstRoute.legs) {
80
78
  distance += leg.distance?.value ?? 0;
81
79
  // todo 考虑用 duration_in_traffic 但这个字段上有条件的