@heycar/heycars-map 1.0.0-coordinate5 → 1.0.0-coordinate7

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.
Files changed (33) hide show
  1. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +1 -1
  2. package/dist/v2/business-components/AuxiliaryUtils/AuxiliaryUtils.d.ts +2 -0
  3. package/dist/v2/business-components/AuxiliaryUtils/AuxiliaryUtils.js +11 -0
  4. package/dist/v2/business-components/AuxiliaryUtils/index.d.ts +1 -0
  5. package/dist/v2/business-components/AuxiliaryUtils/index.js +4 -0
  6. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
  7. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +2 -1
  8. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +2 -1
  9. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +5 -10
  10. package/dist/v2/chunks/{BusinessRecomendPlaceMap.ca62e565.js → BusinessRecomendPlaceMap.87ea3b2f.js} +8 -0
  11. package/dist/v2/hooks/useDeviationCorrectionDrivingRoute.js +2 -1
  12. package/dist/v2/hooks/useMapAuxiliaryUtils.d.ts +14 -0
  13. package/dist/v2/hooks/useMapAuxiliaryUtils.js +152 -0
  14. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +2 -7
  15. package/dist/v2/index.js +1 -1
  16. package/dist/v2/utils/log.js +1 -1
  17. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +1 -1
  18. package/dist/v3/business-components/AuxiliaryUtils/AuxiliaryUtils.d.ts +4 -0
  19. package/dist/v3/business-components/AuxiliaryUtils/AuxiliaryUtils.js +11 -0
  20. package/dist/v3/business-components/AuxiliaryUtils/index.d.ts +1 -0
  21. package/dist/v3/business-components/AuxiliaryUtils/index.js +4 -0
  22. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
  23. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +2 -1
  24. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +2 -1
  25. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +5 -10
  26. package/dist/v3/chunks/{BusinessRecomendPlaceMap.c957231c.js → BusinessRecomendPlaceMap.57b15c64.js} +8 -0
  27. package/dist/v3/hooks/useDeviationCorrectionDrivingRoute.js +2 -1
  28. package/dist/v3/hooks/useMapAuxiliaryUtils.d.ts +14 -0
  29. package/dist/v3/hooks/useMapAuxiliaryUtils.js +152 -0
  30. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +2 -7
  31. package/dist/v3/index.js +1 -1
  32. package/dist/v3/utils/log.js +1 -1
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { h } from "vue";
2
- import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.ca62e565.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
3
3
  import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
4
4
  import { defineSetup } from "../types/helper.js";
5
5
  import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
@@ -0,0 +1,2 @@
1
+ import { type UseMapAuxiliaryUtilsProps } from "../../hooks/useMapAuxiliaryUtils";
2
+ export declare const AuxiliaryUtils: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<Partial<UseMapAuxiliaryUtilsProps>>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<Partial<UseMapAuxiliaryUtilsProps>, Required<Partial<UseMapAuxiliaryUtilsProps>>>, never, Partial<UseMapAuxiliaryUtilsProps>>;
@@ -0,0 +1,11 @@
1
+ import { useMapAuxiliaryUtils } from "../../hooks/useMapAuxiliaryUtils.js";
2
+ import { defineSetup } from "../../types/helper.js";
3
+ const AuxiliaryUtils = defineSetup("AuxiliaryUtils", function(props) {
4
+ const { color = "purple", size = "small", opacity = 0.5 } = props;
5
+ const auxiliaryUtils = useMapAuxiliaryUtils({ color, size, opacity });
6
+ window.auxiliaryUtils = auxiliaryUtils;
7
+ return () => null;
8
+ });
9
+ export {
10
+ AuxiliaryUtils
11
+ };
@@ -0,0 +1 @@
1
+ export * from "./AuxiliaryUtils";
@@ -0,0 +1,4 @@
1
+ import { AuxiliaryUtils } from "./AuxiliaryUtils.js";
2
+ export {
3
+ AuxiliaryUtils
4
+ };
@@ -17,6 +17,7 @@ export declare const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
17
17
  export declare const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
18
18
  export declare const DEFAULT_ZOOM = 17;
19
19
  export declare const ZONE_ZOOM = 13.75;
20
+ export declare const EMPTY_PLACE: CoordinatePlace;
20
21
  export interface CenterPlaceSource {
21
22
  source: "default" | "geo" | "drag" | "recomend" | "api";
22
23
  }
@@ -24,10 +24,11 @@ import "../GreenZone/GreenZone.js";
24
24
  import "../PassengerCircle/PassengerCircle.js";
25
25
  import "../PickupPoints/PickupPoints.js";
26
26
  import "./useCacheCenterPlace.js";
27
- import { B, D, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.ca62e565.js";
27
+ import { B, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
28
28
  export {
29
29
  B as BusinessRecomendPlaceMap,
30
30
  D as DEFAULT_ZOOM,
31
+ E as EMPTY_PLACE,
31
32
  a as RECOMMEND_PLACE_DRAG_LIMIT,
32
33
  c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
33
34
  R as RECOMMEND_PLACE_LARGE_LIMIT,
@@ -1,7 +1,8 @@
1
- import { B, D, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.ca62e565.js";
1
+ import { B, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
2
2
  export {
3
3
  B as BusinessRecomendPlaceMap,
4
4
  D as DEFAULT_ZOOM,
5
+ E as EMPTY_PLACE,
5
6
  a as RECOMMEND_PLACE_DRAG_LIMIT,
6
7
  c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
7
8
  R as RECOMMEND_PLACE_LARGE_LIMIT,
@@ -15,19 +15,13 @@ import { watchPostEffectOnce } from "../../utils/compare.js";
15
15
  import { equalAssign, isPlacesInclude } from "../../utils/helper.js";
16
16
  import { detectBrowserPlatform } from "../../utils/platform.js";
17
17
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
18
- import { toCoordinateRecommendZonePlacesType, toCoordinatePlaceType } from "../../utils/typeChecking.js";
18
+ import { toCoordinatePlaceType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
19
19
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
20
- import { m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.ca62e565.js";
20
+ import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
21
21
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
22
22
  import { GreenZone } from "../GreenZone/GreenZone.js";
23
23
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
24
24
  import { PickupPoints } from "../PickupPoints/PickupPoints.js";
25
- const emptyPlace = {
26
- lng: 0,
27
- lat: 0,
28
- name: "",
29
- displayName: ""
30
- };
31
25
  const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", function(props, {
32
26
  emit,
33
27
  slots,
@@ -41,8 +35,8 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
41
35
  getRecomendPlace,
42
36
  mapContext,
43
37
  disableLocator,
44
- defaultPlace = {
45
- ...emptyPlace
38
+ defaultPlace: inputDefaultPlace = {
39
+ ...EMPTY_PLACE
46
40
  }
47
41
  } = props;
48
42
  const {
@@ -68,6 +62,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
68
62
  mapRef,
69
63
  defaultValue: DEFAULT_ZOOM
70
64
  });
65
+ const defaultPlace = unCoordinatifyPlace(toCoordinatePlaceType(inputDefaultPlace));
71
66
  const centerPlace = reactive({
72
67
  lng: defaultPlace.lng,
73
68
  lat: defaultPlace.lat,
@@ -264,6 +264,13 @@ const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
264
264
  const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
265
265
  const DEFAULT_ZOOM = 17;
266
266
  const ZONE_ZOOM = 13.75;
267
+ const EMPTY_PLACE = {
268
+ lng: 0,
269
+ lat: 0,
270
+ type: "wgs84",
271
+ name: "",
272
+ displayName: ""
273
+ };
267
274
  const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", function(props, {
268
275
  emit,
269
276
  slots,
@@ -576,6 +583,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
576
583
  export {
577
584
  BusinessRecomendPlaceMap as B,
578
585
  DEFAULT_ZOOM as D,
586
+ EMPTY_PLACE as E,
579
587
  RECOMMEND_PLACE_LARGE_LIMIT as R,
580
588
  ZONE_ZOOM as Z,
581
589
  RECOMMEND_PLACE_DRAG_LIMIT as a,
@@ -132,7 +132,7 @@ const createSubRouteByPoint = (route, point, distanceOfLineFn) => {
132
132
  let count = 0;
133
133
  for (const [idx, step] of route.steps.entries()) {
134
134
  count += step.path.length;
135
- if (count < index)
135
+ if (count <= index)
136
136
  continue;
137
137
  const firstStepPath = [point, ...step.path.slice(index - count + 1)];
138
138
  const totalStepDistanceByMeasure = distanceOfLineFn(step.path);
@@ -153,6 +153,7 @@ const createSubRouteByPoint = (route, point, distanceOfLineFn) => {
153
153
  distance += step.distance;
154
154
  duration += step.duration;
155
155
  }
156
+ console.log("point, index, distance, steps, route = ", point, index, distance, steps, route);
156
157
  return { path, duration, distance, steps, index, baseRoute: route };
157
158
  };
158
159
  const createEmptySubRoute = () => {
@@ -0,0 +1,14 @@
1
+ import type { Point } from "../types/interface";
2
+ export interface MapAuxiliaryUtils {
3
+ paint: (value: Point | Point[]) => void;
4
+ clear: (value: Point | Point[]) => void;
5
+ clearAll: () => void;
6
+ }
7
+ export interface UseMapAuxiliaryUtilsProps {
8
+ color: string;
9
+ size: "small" | "medium" | "large";
10
+ opacity: number;
11
+ }
12
+ export declare const useAmapAuxiliaryUtils: (props: UseMapAuxiliaryUtilsProps) => MapAuxiliaryUtils;
13
+ export declare const useGmapAuxiliaryUtils: (props: UseMapAuxiliaryUtilsProps) => MapAuxiliaryUtils;
14
+ export declare const useMapAuxiliaryUtils: (props: UseMapAuxiliaryUtilsProps) => MapAuxiliaryUtils;
@@ -0,0 +1,152 @@
1
+ import { assertPoint } from "../utils/helper.js";
2
+ import { vec2lnglat } from "../utils/transform.js";
3
+ import { useAmap, useGmap } from "./useMap.js";
4
+ import { useMapSupplier } from "./useMapSupplier.js";
5
+ function assertMapExist(value) {
6
+ if (value === void 0)
7
+ throw Error("assertMapExist: map is not exist");
8
+ }
9
+ function assertPointArray(value) {
10
+ if (!Array.isArray(value))
11
+ throw Error("assertPointArray: value is not array");
12
+ value.forEach(assertPoint);
13
+ }
14
+ const AUXILIARY_UTILS_POINT_ZINDEX = 99;
15
+ const AUXILIARY_UTILS_LINE_ZINDEX = 100;
16
+ const pointRadiusSize = {
17
+ small: 3,
18
+ medium: 5,
19
+ large: 10
20
+ };
21
+ const lineWeightSize = {
22
+ small: 1,
23
+ medium: 3,
24
+ large: 5
25
+ };
26
+ const useAmapAuxiliaryUtils = (props) => {
27
+ const paintedMap = /* @__PURE__ */ new Map();
28
+ const mapRef = useAmap();
29
+ const paintPoint = (point) => {
30
+ const map = mapRef == null ? void 0 : mapRef.value;
31
+ assertPoint(point);
32
+ assertMapExist(map);
33
+ const { color, size, opacity } = props;
34
+ const radius = pointRadiusSize[size];
35
+ const circle = new AMap.Circle({
36
+ center: point,
37
+ radius,
38
+ fillColor: "transparent",
39
+ strokeColor: color,
40
+ strokeOpacity: opacity,
41
+ zIndex: AUXILIARY_UTILS_POINT_ZINDEX
42
+ });
43
+ const key = JSON.stringify(point);
44
+ paintedMap.set(key, circle);
45
+ map.add(circle);
46
+ };
47
+ const pointPolyline = (points) => {
48
+ const map = mapRef == null ? void 0 : mapRef.value;
49
+ assertPointArray(points);
50
+ assertMapExist(map);
51
+ const { color, size, opacity } = props;
52
+ const strokeWeight = lineWeightSize[size];
53
+ const polyline = new AMap.Polyline({
54
+ path: points,
55
+ strokeWeight,
56
+ strokeColor: color,
57
+ strokeOpacity: opacity,
58
+ zIndex: AUXILIARY_UTILS_LINE_ZINDEX
59
+ });
60
+ const key = JSON.stringify(points);
61
+ paintedMap.set(key, polyline);
62
+ map.add(polyline);
63
+ };
64
+ const paint = (value) => {
65
+ Array.isArray(value) && Array.isArray(value[0]) ? pointPolyline(value) : paintPoint(value);
66
+ };
67
+ const clear = (value) => {
68
+ const map = mapRef == null ? void 0 : mapRef.value;
69
+ assertMapExist(map);
70
+ const key = JSON.stringify(value);
71
+ const overlay = paintedMap.get(key);
72
+ if (overlay)
73
+ map.remove(overlay);
74
+ };
75
+ const clearAll = () => {
76
+ const map = mapRef == null ? void 0 : mapRef.value;
77
+ assertMapExist(map);
78
+ for (const overlay of paintedMap.values()) {
79
+ map.remove(overlay);
80
+ }
81
+ paintedMap.clear();
82
+ };
83
+ return { paint, clear, clearAll };
84
+ };
85
+ const useGmapAuxiliaryUtils = (props) => {
86
+ const paintedMap = /* @__PURE__ */ new Map();
87
+ const mapRef = useGmap();
88
+ const paintPoint = (point) => {
89
+ const map = mapRef == null ? void 0 : mapRef.value;
90
+ assertPoint(point);
91
+ assertMapExist(map);
92
+ const { color, size, opacity } = props;
93
+ const radius = pointRadiusSize[size];
94
+ const circle = new google.maps.Circle({
95
+ map,
96
+ center: vec2lnglat(point),
97
+ radius,
98
+ fillColor: "transparent",
99
+ strokeColor: color,
100
+ strokeOpacity: opacity,
101
+ zIndex: AUXILIARY_UTILS_POINT_ZINDEX
102
+ });
103
+ const key = JSON.stringify(point);
104
+ paintedMap.set(key, circle);
105
+ };
106
+ const pointPolyline = (points) => {
107
+ const map = mapRef == null ? void 0 : mapRef.value;
108
+ assertPointArray(points);
109
+ assertMapExist(map);
110
+ const { color, size, opacity } = props;
111
+ const strokeWeight = lineWeightSize[size];
112
+ const polyline = new google.maps.Polyline({
113
+ map,
114
+ path: points.map(vec2lnglat),
115
+ strokeWeight,
116
+ strokeColor: color,
117
+ strokeOpacity: opacity,
118
+ zIndex: AUXILIARY_UTILS_LINE_ZINDEX
119
+ });
120
+ const key = JSON.stringify(points);
121
+ paintedMap.set(key, polyline);
122
+ };
123
+ const paint = (value) => {
124
+ Array.isArray(value) && Array.isArray(value[0]) ? pointPolyline(value) : paintPoint(value);
125
+ };
126
+ const clear = (value) => {
127
+ const map = mapRef == null ? void 0 : mapRef.value;
128
+ assertMapExist(map);
129
+ const key = JSON.stringify(value);
130
+ const overlay = paintedMap.get(key);
131
+ if (overlay)
132
+ overlay.setMap(null);
133
+ };
134
+ const clearAll = () => {
135
+ const map = mapRef == null ? void 0 : mapRef.value;
136
+ assertMapExist(map);
137
+ for (const overlay of paintedMap.values()) {
138
+ overlay.setMap(null);
139
+ }
140
+ paintedMap.clear();
141
+ };
142
+ return { paint, clear, clearAll };
143
+ };
144
+ const useMapAuxiliaryUtils = (props) => {
145
+ const { supplier } = useMapSupplier();
146
+ return supplier === "gmap" ? useGmapAuxiliaryUtils(props) : useAmapAuxiliaryUtils(props);
147
+ };
148
+ export {
149
+ useAmapAuxiliaryUtils,
150
+ useGmapAuxiliaryUtils,
151
+ useMapAuxiliaryUtils
152
+ };
@@ -1,17 +1,12 @@
1
1
  import { reactive, ref, readonly } from "vue-demi";
2
+ import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
2
3
  import { useGoogleConnection } from "../hooks/useGoogleConnection.js";
3
4
  import { useMapGeometry } from "../hooks/useMapGeometry.js";
4
5
  import { useMapInChina } from "../hooks/useMapInChina.js";
5
6
  import { CenterPlaceStatus } from "../types/interface.js";
6
7
  import { equalAssign } from "../utils/helper.js";
7
8
  const useBusinessRecomendPlaceMap = () => {
8
- const centerPlace = reactive({
9
- lng: 0,
10
- lat: 0,
11
- type: "wgs84",
12
- name: "",
13
- displayName: ""
14
- });
9
+ const centerPlace = reactive({ ...EMPTY_PLACE });
15
10
  const placeCandidates = ref([]);
16
11
  const geoPositionRef = ref();
17
12
  const centerPlaceStatusRef = ref(CenterPlaceStatus.GEO_LOADING);
package/dist/v2/index.js CHANGED
@@ -2,7 +2,7 @@ import "./utils/alipayPolyfill.js";
2
2
  import { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
3
3
  import { AddressBox } from "./business-components/AddressBox/AddressBox.js";
4
4
  import { BusinessQuotingMap } from "./business-components/BusinessQuotingMap/BusinessQuotingMap.js";
5
- import { B } from "./chunks/BusinessRecomendPlaceMap.ca62e565.js";
5
+ import { B } from "./chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
6
6
  import { BusinessReselectPlaceMap } from "./business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js";
7
7
  import { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
8
8
  import { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js";
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "1.0.0-coordinate5";
3
+ const pkgVersion = "1.0.0-coordinate7";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -1,5 +1,5 @@
1
1
  import { createVNode } from "vue";
2
- import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.c957231c.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.57b15c64.js";
3
3
  import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
4
4
  import { defineSetup } from "../types/helper.js";
5
5
  import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
@@ -0,0 +1,4 @@
1
+ import { type UseMapAuxiliaryUtilsProps } from "../../hooks/useMapAuxiliaryUtils";
2
+ export declare const AuxiliaryUtils: import("vue").DefineComponent<import("vue").ComponentObjectPropsOptions<Partial<UseMapAuxiliaryUtilsProps>>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<Partial<UseMapAuxiliaryUtilsProps>, Required<Partial<UseMapAuxiliaryUtilsProps>>>, never, import("vue").PublicProps, Partial<UseMapAuxiliaryUtilsProps>, Partial<UseMapAuxiliaryUtilsProps>, import("vue").SlotsType<{} & {
3
+ default?: import("../../demi-polyfill").Slot | undefined;
4
+ }>>;
@@ -0,0 +1,11 @@
1
+ import { useMapAuxiliaryUtils } from "../../hooks/useMapAuxiliaryUtils.js";
2
+ import { defineSetup } from "../../types/helper.js";
3
+ const AuxiliaryUtils = defineSetup("AuxiliaryUtils", function(props) {
4
+ const { color = "purple", size = "small", opacity = 0.5 } = props;
5
+ const auxiliaryUtils = useMapAuxiliaryUtils({ color, size, opacity });
6
+ window.auxiliaryUtils = auxiliaryUtils;
7
+ return () => null;
8
+ });
9
+ export {
10
+ AuxiliaryUtils
11
+ };
@@ -0,0 +1 @@
1
+ export * from "./AuxiliaryUtils";
@@ -0,0 +1,4 @@
1
+ import { AuxiliaryUtils } from "./AuxiliaryUtils.js";
2
+ export {
3
+ AuxiliaryUtils
4
+ };
@@ -17,6 +17,7 @@ export declare const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
17
17
  export declare const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
18
18
  export declare const DEFAULT_ZOOM = 17;
19
19
  export declare const ZONE_ZOOM = 13.75;
20
+ export declare const EMPTY_PLACE: CoordinatePlace;
20
21
  export interface CenterPlaceSource {
21
22
  source: "default" | "geo" | "drag" | "recomend" | "api";
22
23
  }
@@ -24,10 +24,11 @@ import "../GreenZone/GreenZone.js";
24
24
  import "../PassengerCircle/PassengerCircle.js";
25
25
  import "../PickupPoints/PickupPoints.js";
26
26
  import "./useCacheCenterPlace.js";
27
- import { B, D, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.c957231c.js";
27
+ import { B, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.57b15c64.js";
28
28
  export {
29
29
  B as BusinessRecomendPlaceMap,
30
30
  D as DEFAULT_ZOOM,
31
+ E as EMPTY_PLACE,
31
32
  a as RECOMMEND_PLACE_DRAG_LIMIT,
32
33
  c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
33
34
  R as RECOMMEND_PLACE_LARGE_LIMIT,
@@ -1,7 +1,8 @@
1
- import { B, D, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.c957231c.js";
1
+ import { B, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.57b15c64.js";
2
2
  export {
3
3
  B as BusinessRecomendPlaceMap,
4
4
  D as DEFAULT_ZOOM,
5
+ E as EMPTY_PLACE,
5
6
  a as RECOMMEND_PLACE_DRAG_LIMIT,
6
7
  c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
7
8
  R as RECOMMEND_PLACE_LARGE_LIMIT,
@@ -15,19 +15,13 @@ import { watchPostEffectOnce } from "../../utils/compare.js";
15
15
  import { equalAssign, isPlacesInclude } from "../../utils/helper.js";
16
16
  import { detectBrowserPlatform } from "../../utils/platform.js";
17
17
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
18
- import { toCoordinateRecommendZonePlacesType, toCoordinatePlaceType } from "../../utils/typeChecking.js";
18
+ import { toCoordinatePlaceType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
19
19
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
20
- import { m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.c957231c.js";
20
+ import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.57b15c64.js";
21
21
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
22
22
  import { GreenZone } from "../GreenZone/GreenZone.js";
23
23
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
24
24
  import { PickupPoints } from "../PickupPoints/PickupPoints.js";
25
- const emptyPlace = {
26
- lng: 0,
27
- lat: 0,
28
- name: "",
29
- displayName: ""
30
- };
31
25
  const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", function(props, {
32
26
  emit,
33
27
  slots,
@@ -41,8 +35,8 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
41
35
  getRecomendPlace,
42
36
  mapContext,
43
37
  disableLocator,
44
- defaultPlace = {
45
- ...emptyPlace
38
+ defaultPlace: inputDefaultPlace = {
39
+ ...EMPTY_PLACE
46
40
  }
47
41
  } = props;
48
42
  const {
@@ -68,6 +62,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
68
62
  mapRef,
69
63
  defaultValue: DEFAULT_ZOOM
70
64
  });
65
+ const defaultPlace = unCoordinatifyPlace(toCoordinatePlaceType(inputDefaultPlace));
71
66
  const centerPlace = reactive({
72
67
  lng: defaultPlace.lng,
73
68
  lat: defaultPlace.lat,
@@ -264,6 +264,13 @@ const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
264
264
  const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
265
265
  const DEFAULT_ZOOM = 17;
266
266
  const ZONE_ZOOM = 13.75;
267
+ const EMPTY_PLACE = {
268
+ lng: 0,
269
+ lat: 0,
270
+ type: "wgs84",
271
+ name: "",
272
+ displayName: ""
273
+ };
267
274
  const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", function(props, {
268
275
  emit,
269
276
  slots,
@@ -565,6 +572,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
565
572
  export {
566
573
  BusinessRecomendPlaceMap as B,
567
574
  DEFAULT_ZOOM as D,
575
+ EMPTY_PLACE as E,
568
576
  RECOMMEND_PLACE_LARGE_LIMIT as R,
569
577
  ZONE_ZOOM as Z,
570
578
  RECOMMEND_PLACE_DRAG_LIMIT as a,
@@ -132,7 +132,7 @@ const createSubRouteByPoint = (route, point, distanceOfLineFn) => {
132
132
  let count = 0;
133
133
  for (const [idx, step] of route.steps.entries()) {
134
134
  count += step.path.length;
135
- if (count < index)
135
+ if (count <= index)
136
136
  continue;
137
137
  const firstStepPath = [point, ...step.path.slice(index - count + 1)];
138
138
  const totalStepDistanceByMeasure = distanceOfLineFn(step.path);
@@ -153,6 +153,7 @@ const createSubRouteByPoint = (route, point, distanceOfLineFn) => {
153
153
  distance += step.distance;
154
154
  duration += step.duration;
155
155
  }
156
+ console.log("point, index, distance, steps, route = ", point, index, distance, steps, route);
156
157
  return { path, duration, distance, steps, index, baseRoute: route };
157
158
  };
158
159
  const createEmptySubRoute = () => {
@@ -0,0 +1,14 @@
1
+ import type { Point } from "../types/interface";
2
+ export interface MapAuxiliaryUtils {
3
+ paint: (value: Point | Point[]) => void;
4
+ clear: (value: Point | Point[]) => void;
5
+ clearAll: () => void;
6
+ }
7
+ export interface UseMapAuxiliaryUtilsProps {
8
+ color: string;
9
+ size: "small" | "medium" | "large";
10
+ opacity: number;
11
+ }
12
+ export declare const useAmapAuxiliaryUtils: (props: UseMapAuxiliaryUtilsProps) => MapAuxiliaryUtils;
13
+ export declare const useGmapAuxiliaryUtils: (props: UseMapAuxiliaryUtilsProps) => MapAuxiliaryUtils;
14
+ export declare const useMapAuxiliaryUtils: (props: UseMapAuxiliaryUtilsProps) => MapAuxiliaryUtils;
@@ -0,0 +1,152 @@
1
+ import { assertPoint } from "../utils/helper.js";
2
+ import { vec2lnglat } from "../utils/transform.js";
3
+ import { useAmap, useGmap } from "./useMap.js";
4
+ import { useMapSupplier } from "./useMapSupplier.js";
5
+ function assertMapExist(value) {
6
+ if (value === void 0)
7
+ throw Error("assertMapExist: map is not exist");
8
+ }
9
+ function assertPointArray(value) {
10
+ if (!Array.isArray(value))
11
+ throw Error("assertPointArray: value is not array");
12
+ value.forEach(assertPoint);
13
+ }
14
+ const AUXILIARY_UTILS_POINT_ZINDEX = 99;
15
+ const AUXILIARY_UTILS_LINE_ZINDEX = 100;
16
+ const pointRadiusSize = {
17
+ small: 3,
18
+ medium: 5,
19
+ large: 10
20
+ };
21
+ const lineWeightSize = {
22
+ small: 1,
23
+ medium: 3,
24
+ large: 5
25
+ };
26
+ const useAmapAuxiliaryUtils = (props) => {
27
+ const paintedMap = /* @__PURE__ */ new Map();
28
+ const mapRef = useAmap();
29
+ const paintPoint = (point) => {
30
+ const map = mapRef == null ? void 0 : mapRef.value;
31
+ assertPoint(point);
32
+ assertMapExist(map);
33
+ const { color, size, opacity } = props;
34
+ const radius = pointRadiusSize[size];
35
+ const circle = new AMap.Circle({
36
+ center: point,
37
+ radius,
38
+ fillColor: "transparent",
39
+ strokeColor: color,
40
+ strokeOpacity: opacity,
41
+ zIndex: AUXILIARY_UTILS_POINT_ZINDEX
42
+ });
43
+ const key = JSON.stringify(point);
44
+ paintedMap.set(key, circle);
45
+ map.add(circle);
46
+ };
47
+ const pointPolyline = (points) => {
48
+ const map = mapRef == null ? void 0 : mapRef.value;
49
+ assertPointArray(points);
50
+ assertMapExist(map);
51
+ const { color, size, opacity } = props;
52
+ const strokeWeight = lineWeightSize[size];
53
+ const polyline = new AMap.Polyline({
54
+ path: points,
55
+ strokeWeight,
56
+ strokeColor: color,
57
+ strokeOpacity: opacity,
58
+ zIndex: AUXILIARY_UTILS_LINE_ZINDEX
59
+ });
60
+ const key = JSON.stringify(points);
61
+ paintedMap.set(key, polyline);
62
+ map.add(polyline);
63
+ };
64
+ const paint = (value) => {
65
+ Array.isArray(value) && Array.isArray(value[0]) ? pointPolyline(value) : paintPoint(value);
66
+ };
67
+ const clear = (value) => {
68
+ const map = mapRef == null ? void 0 : mapRef.value;
69
+ assertMapExist(map);
70
+ const key = JSON.stringify(value);
71
+ const overlay = paintedMap.get(key);
72
+ if (overlay)
73
+ map.remove(overlay);
74
+ };
75
+ const clearAll = () => {
76
+ const map = mapRef == null ? void 0 : mapRef.value;
77
+ assertMapExist(map);
78
+ for (const overlay of paintedMap.values()) {
79
+ map.remove(overlay);
80
+ }
81
+ paintedMap.clear();
82
+ };
83
+ return { paint, clear, clearAll };
84
+ };
85
+ const useGmapAuxiliaryUtils = (props) => {
86
+ const paintedMap = /* @__PURE__ */ new Map();
87
+ const mapRef = useGmap();
88
+ const paintPoint = (point) => {
89
+ const map = mapRef == null ? void 0 : mapRef.value;
90
+ assertPoint(point);
91
+ assertMapExist(map);
92
+ const { color, size, opacity } = props;
93
+ const radius = pointRadiusSize[size];
94
+ const circle = new google.maps.Circle({
95
+ map,
96
+ center: vec2lnglat(point),
97
+ radius,
98
+ fillColor: "transparent",
99
+ strokeColor: color,
100
+ strokeOpacity: opacity,
101
+ zIndex: AUXILIARY_UTILS_POINT_ZINDEX
102
+ });
103
+ const key = JSON.stringify(point);
104
+ paintedMap.set(key, circle);
105
+ };
106
+ const pointPolyline = (points) => {
107
+ const map = mapRef == null ? void 0 : mapRef.value;
108
+ assertPointArray(points);
109
+ assertMapExist(map);
110
+ const { color, size, opacity } = props;
111
+ const strokeWeight = lineWeightSize[size];
112
+ const polyline = new google.maps.Polyline({
113
+ map,
114
+ path: points.map(vec2lnglat),
115
+ strokeWeight,
116
+ strokeColor: color,
117
+ strokeOpacity: opacity,
118
+ zIndex: AUXILIARY_UTILS_LINE_ZINDEX
119
+ });
120
+ const key = JSON.stringify(points);
121
+ paintedMap.set(key, polyline);
122
+ };
123
+ const paint = (value) => {
124
+ Array.isArray(value) && Array.isArray(value[0]) ? pointPolyline(value) : paintPoint(value);
125
+ };
126
+ const clear = (value) => {
127
+ const map = mapRef == null ? void 0 : mapRef.value;
128
+ assertMapExist(map);
129
+ const key = JSON.stringify(value);
130
+ const overlay = paintedMap.get(key);
131
+ if (overlay)
132
+ overlay.setMap(null);
133
+ };
134
+ const clearAll = () => {
135
+ const map = mapRef == null ? void 0 : mapRef.value;
136
+ assertMapExist(map);
137
+ for (const overlay of paintedMap.values()) {
138
+ overlay.setMap(null);
139
+ }
140
+ paintedMap.clear();
141
+ };
142
+ return { paint, clear, clearAll };
143
+ };
144
+ const useMapAuxiliaryUtils = (props) => {
145
+ const { supplier } = useMapSupplier();
146
+ return supplier === "gmap" ? useGmapAuxiliaryUtils(props) : useAmapAuxiliaryUtils(props);
147
+ };
148
+ export {
149
+ useAmapAuxiliaryUtils,
150
+ useGmapAuxiliaryUtils,
151
+ useMapAuxiliaryUtils
152
+ };
@@ -1,17 +1,12 @@
1
1
  import { reactive, ref, readonly } from "vue-demi";
2
+ import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.57b15c64.js";
2
3
  import { useGoogleConnection } from "../hooks/useGoogleConnection.js";
3
4
  import { useMapGeometry } from "../hooks/useMapGeometry.js";
4
5
  import { useMapInChina } from "../hooks/useMapInChina.js";
5
6
  import { CenterPlaceStatus } from "../types/interface.js";
6
7
  import { equalAssign } from "../utils/helper.js";
7
8
  const useBusinessRecomendPlaceMap = () => {
8
- const centerPlace = reactive({
9
- lng: 0,
10
- lat: 0,
11
- type: "wgs84",
12
- name: "",
13
- displayName: ""
14
- });
9
+ const centerPlace = reactive({ ...EMPTY_PLACE });
15
10
  const placeCandidates = ref([]);
16
11
  const geoPositionRef = ref();
17
12
  const centerPlaceStatusRef = ref(CenterPlaceStatus.GEO_LOADING);
package/dist/v3/index.js CHANGED
@@ -2,7 +2,7 @@ import "./utils/alipayPolyfill.js";
2
2
  import { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
3
3
  import { AddressBox } from "./business-components/AddressBox/AddressBox.js";
4
4
  import { BusinessQuotingMap } from "./business-components/BusinessQuotingMap/BusinessQuotingMap.js";
5
- import { B } from "./chunks/BusinessRecomendPlaceMap.c957231c.js";
5
+ import { B } from "./chunks/BusinessRecomendPlaceMap.57b15c64.js";
6
6
  import { BusinessReselectPlaceMap } from "./business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js";
7
7
  import { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
8
8
  import { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js";
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "1.0.0-coordinate5";
3
+ const pkgVersion = "1.0.0-coordinate7";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "1.0.0-coordinate5",
3
+ "version": "1.0.0-coordinate7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",