@heycar/heycars-map 2.0.0-switchMap3 → 2.0.0-switchMap4

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 (39) hide show
  1. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +1 -1
  2. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +1 -1
  3. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  4. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
  5. package/dist/v2/chunks/{BusinessRecomendPlaceMap.f589ebf7.js → BusinessRecomendPlaceMap.4b641c71.js} +6 -3
  6. package/dist/v2/chunks/{Loading.da68a2a6.js → Loading.f2515cd7.js} +8 -10
  7. package/dist/v2/components/Loading/Loading.css.d.ts +2 -2
  8. package/dist/v2/components/Loading/Loading.js +1 -1
  9. package/dist/v2/components/Loading/index.js +1 -1
  10. package/dist/v2/components/MapProvider/MapProvider.js +1 -1
  11. package/dist/{v3/css/Loading-0e058b68.css → v2/css/Loading-49e58ced.css} +6 -11
  12. package/dist/v2/hooks/useMapGCJ02.js +0 -3
  13. package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
  14. package/dist/v2/hooks/useMapGeometry.js +4 -4
  15. package/dist/v2/hooks/useMapPlace.js +42 -35
  16. package/dist/v2/hooks/useMapRecomendPlace.js +4 -4
  17. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  18. package/dist/v2/index.js +1 -1
  19. package/dist/v2/utils/log.js +1 -1
  20. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +1 -1
  21. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +1 -1
  22. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  23. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
  24. package/dist/v3/chunks/{BusinessRecomendPlaceMap.86e9c287.js → BusinessRecomendPlaceMap.4befb6c7.js} +6 -3
  25. package/dist/v3/chunks/{Loading.98d687c0.js → Loading.32ae3c98.js} +8 -10
  26. package/dist/v3/components/Loading/Loading.css.d.ts +2 -2
  27. package/dist/v3/components/Loading/Loading.js +1 -1
  28. package/dist/v3/components/Loading/index.js +1 -1
  29. package/dist/v3/components/MapProvider/MapProvider.js +1 -1
  30. package/dist/{v2/css/Loading-0e058b68.css → v3/css/Loading-49e58ced.css} +6 -11
  31. package/dist/v3/hooks/useMapGCJ02.js +0 -3
  32. package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
  33. package/dist/v3/hooks/useMapGeometry.js +4 -4
  34. package/dist/v3/hooks/useMapPlace.js +42 -35
  35. package/dist/v3/hooks/useMapRecomendPlace.js +4 -4
  36. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  37. package/dist/v3/index.js +1 -1
  38. package/dist/v3/utils/log.js +1 -1
  39. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { h } from "vue";
2
- import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.4b641c71.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";
@@ -26,7 +26,7 @@ import "../GreenZone/GreenZone.js";
26
26
  import "../PassengerCircle/PassengerCircle.js";
27
27
  import "../PickupPoints/PickupPoints.js";
28
28
  import "./useCacheCenterPlace.js";
29
- import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
29
+ import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.4b641c71.js";
30
30
  export {
31
31
  B as BusinessRecomendPlaceMap,
32
32
  f as BusinessRecomendPlaceMapInner,
@@ -1,4 +1,4 @@
1
- import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
1
+ import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.4b641c71.js";
2
2
  export {
3
3
  B as BusinessRecomendPlaceMap,
4
4
  f as BusinessRecomendPlaceMapInner,
@@ -20,7 +20,7 @@ import { detectBrowserPlatform } from "../../utils/platform.js";
20
20
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
21
21
  import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
22
22
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
23
- 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.f589ebf7.js";
23
+ 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.4b641c71.js";
24
24
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
25
25
  import { GreenZone } from "../GreenZone/GreenZone.js";
26
26
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
@@ -316,7 +316,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
316
316
  defaultValue: DEFAULT_ZOOM
317
317
  });
318
318
  const {
319
- readyPromise
319
+ readyPromise,
320
+ supplier
320
321
  } = useMapSupplier();
321
322
  const {
322
323
  assertSupplier
@@ -400,7 +401,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
400
401
  if (!isFirstLoad)
401
402
  return;
402
403
  const [lng, lat] = value.position;
403
- await readyPromise;
404
+ if (supplier === "amap")
405
+ await readyPromise;
404
406
  centerSource.source = "geo";
405
407
  centerPlace.lng = lng;
406
408
  centerPlace.lat = lat;
@@ -410,7 +412,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
410
412
  emit("loadDefaultGeoLocation", coordinatifyGeoPosition(value));
411
413
  if (!isFirstLoad)
412
414
  return;
413
- await readyPromise;
415
+ if (supplier === "amap")
416
+ await readyPromise;
414
417
  centerSource.source = "geo";
415
418
  updatePlace(value.position);
416
419
  },
@@ -1,17 +1,17 @@
1
- import "../css/Loading-0e058b68.css";
1
+ import "../css/Loading-49e58ced.css";
2
2
  import { h } from "vue";
3
3
  import { ICON_LOAD_FAILED_URL } from "../api/cdn.js";
4
4
  import { AbsoluteAddressBox } from "../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
5
5
  import { defineSetup } from "../types/helper.js";
6
6
  const imgGrid = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzg1IiBoZWlnaHQ9IjgxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBzdHJva2U9IiNEOERCRTIiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWRhc2hhcnJheT0iMSI+PHBhdGggZD0iTS41IDgxN1YwTTI0LjUgODE3VjBNNDguNSA4MTdWME03Mi41IDgxN1YwTTk2LjUgODE3VjBNMTIwLjUgODE3VjBNMTQ0LjUgODE3VjBNMTY4LjUgODE3VjBNMTkyLjUgODE3VjBNMjE2LjUgODE3VjBNMjQwLjUgODE3VjBNMjY0LjUgODE3VjBNMjg4LjUgODE3VjBNMzEyLjUgODE3VjBNMzM2LjUgODE3VjBNMzYwLjUgODE3VjBNMzg0LjUgODE3VjBNMCAuNWgzODVNMCAyNC41aDM4NU0wIDQ4LjVoMzg1TTAgNzIuNWgzODVNMCA5Ni41aDM4NU0wIDEyMC41aDM4NU0wIDE0NC41aDM4NU0wIDE2OC41aDM4NU0wIDE5Mi41aDM4NU0wIDIxNi41aDM4NU0wIDI0MC41aDM4NU0wIDI2NC41aDM4NU0wIDI4OC41aDM4NU0wIDMxMi41aDM4NU0wIDMzNi41aDM4NU0wIDM2MC41aDM4NU0wIDM4NC41aDM4NU0wIDQwOC41aDM4NU0wIDQzMi41aDM4NU0wIDQ1Ni41aDM4NU0wIDQ4MC41aDM4NU0wIDUwNC41aDM4NU0wIDUyOC41aDM4NU0wIDU1Mi41aDM4NU0wIDU3Ni41aDM4NU0wIDYwMC41aDM4NU0wIDYyNC41aDM4NU0wIDY0OC41aDM4NU0wIDY3Mi41aDM4NU0wIDY5Ni41aDM4NU0wIDcyMC41aDM4NU0wIDc0NC41aDM4NU0wIDc2OC41aDM4NU0wIDc5Mi41aDM4NU0wIDgxNi41aDM4NSIvPjwvZz48L3N2Zz4=";
7
7
  const Loading_css_ts_vanilla = "";
8
+ var contentLayout = "_17ify492";
8
9
  var description = "_17ify496";
9
- var iconLayout = "_17ify492";
10
10
  var iconLoadFailed = "_17ify493";
11
11
  var loadingBg = "_17ify491";
12
12
  var loadingLayout = "_17ify490";
13
- var textLayout = "_17ify494";
14
13
  var title = "_17ify495";
14
+ var verticalGap = "_17ify494";
15
15
  const Loading = defineSetup("Loading", function() {
16
16
  return () => h("div", {
17
17
  "class": loadingLayout
@@ -36,19 +36,17 @@ const LoadFailed = defineSetup("LoadFailed", function(props) {
36
36
  "src": imgGrid
37
37
  }
38
38
  }), h("div", {
39
- "class": iconLayout
39
+ "class": contentLayout
40
40
  }, [h("img", {
41
41
  "class": iconLoadFailed,
42
42
  "attrs": {
43
43
  "src": ICON_LOAD_FAILED_URL
44
44
  }
45
- }), h("div", {
46
- "class": textLayout
47
- }, [h("span", {
48
- "class": title
45
+ }), h("span", {
46
+ "class": `${title} ${verticalGap}`
49
47
  }, [props.title]), h("span", {
50
- "class": description
51
- }, [props.description])])])]);
48
+ "class": `${description} ${verticalGap}`
49
+ }, [props.description])])]);
52
50
  });
53
51
  export {
54
52
  Loading as L,
@@ -1,7 +1,7 @@
1
1
  export declare const loadingLayout: string;
2
2
  export declare const loadingBg: string;
3
- export declare const iconLayout: string;
3
+ export declare const contentLayout: string;
4
4
  export declare const iconLoadFailed: string;
5
- export declare const textLayout: string;
5
+ export declare const verticalGap: string;
6
6
  export declare const title: string;
7
7
  export declare const description: string;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
2
  import "../../api/cdn.js";
3
- import { a, L } from "../../chunks/Loading.da68a2a6.js";
3
+ import { a, L } from "../../chunks/Loading.f2515cd7.js";
4
4
  import "../../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
5
5
  import "../../types/helper.js";
6
6
  export {
@@ -1,4 +1,4 @@
1
- import { a, L } from "../../chunks/Loading.da68a2a6.js";
1
+ import { a, L } from "../../chunks/Loading.f2515cd7.js";
2
2
  export {
3
3
  a as LoadFailed,
4
4
  L as Loading
@@ -1,6 +1,6 @@
1
1
  import "../../css/MapProvider-156bfd53.css";
2
2
  import { h } from "vue";
3
- import { L as Loading, a as LoadFailed, i as imgGrid } from "../../chunks/Loading.da68a2a6.js";
3
+ import { L as Loading, a as LoadFailed, i as imgGrid } from "../../chunks/Loading.f2515cd7.js";
4
4
  import { useMapLoader, Status } from "../../hooks/useMapLoader.js";
5
5
  import { provideMapSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
6
6
  import { defineLagecySetup } from "../../types/helper.js";
@@ -3,6 +3,7 @@
3
3
  background-color: #EDF1F5;
4
4
  }
5
5
  ._17ify491 {
6
+ position: absolute;
6
7
  width: 100%;
7
8
  height: 100%;
8
9
  object-fit: cover;
@@ -10,29 +11,24 @@
10
11
  ._17ify492 {
11
12
  position: absolute;
12
13
  margin: auto;
13
- top: 0;
14
+ top: -5vh;
14
15
  left: 0;
15
16
  right: 0;
16
17
  bottom: 0;
17
18
  width: fit-content;
18
19
  height: fit-content;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
19
23
  }
20
24
  ._17ify493 {
21
25
  width: 40.8vw;
22
26
  height: 24.53vw;
23
27
  }
24
28
  ._17ify494 {
25
- position: absolute;
26
- top: 100%;
27
- display: flex;
28
- flex-direction: column;
29
- align-items: center;
30
- width: max-content;
31
- left: 50%;
32
- transform: translate(-50%, 0);
29
+ margin-top: 1.6vw;
33
30
  }
34
31
  ._17ify495 {
35
- margin-top: 1.6vw;
36
32
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
37
33
  font-weight: 500;
38
34
  font-size: 4vw;
@@ -40,7 +36,6 @@
40
36
  line-height: 6.4vw;
41
37
  }
42
38
  ._17ify496 {
43
- margin-top: 1.6vw;
44
39
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
45
40
  font-weight: 400;
46
41
  font-size: 3.73vw;
@@ -565,7 +565,6 @@ const useAmapGCJ02 = () => {
565
565
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
566
566
  };
567
567
  const useGmapGCJ02 = () => {
568
- const { readyPromise } = useMapSupplier();
569
568
  const toCoordinateType = (p) => {
570
569
  return inChina(p) && !inHongkong(p) && !inMacau(p) ? "gcj02" : "wgs84";
571
570
  };
@@ -583,11 +582,9 @@ const useGmapGCJ02 = () => {
583
582
  };
584
583
  const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
585
584
  const toGcj02 = async (point) => {
586
- await readyPromise;
587
585
  return toLocalGcj02Points([point])[0];
588
586
  };
589
587
  const toGcj02Points = async (points) => {
590
- await readyPromise;
591
588
  return toLocalGcj02Points(points);
592
589
  };
593
590
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
@@ -1,19 +1,17 @@
1
1
  import type { Point } from "../types/interface";
2
+ export declare const apiLocalIsPointInRing: (point: Point, path: Point[]) => boolean;
2
3
  export declare const useAmapGeometry: () => {
3
4
  apiMapDistance: (from: Point, to: Point) => number | undefined;
4
5
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
5
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
6
6
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
7
7
  };
8
8
  export declare const useGmapGeometry: () => {
9
9
  apiMapDistance: (from: Point, to: Point) => number | undefined;
10
10
  apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
11
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
12
11
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
13
12
  };
14
13
  export declare const useMapGeometry: () => {
15
14
  apiMapDistance: (from: Point, to: Point) => number | undefined;
16
15
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
17
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
18
16
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
19
17
  };
@@ -2,6 +2,7 @@ import { pointInPolygon } from "../utils/geometryPolygon.js";
2
2
  import { vec2lnglat } from "../utils/transform.js";
3
3
  import { Status } from "./useMapLoader.js";
4
4
  import { useMapSupplier } from "./useMapSupplier.js";
5
+ const apiLocalIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
5
6
  const useAmapGeometry = () => {
6
7
  const payload = useMapSupplier();
7
8
  const apiMapDistance = (from, to) => {
@@ -19,8 +20,7 @@ const useAmapGeometry = () => {
19
20
  return void 0;
20
21
  return AMap.GeometryUtil.distanceOfLine(line);
21
22
  };
22
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
23
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
23
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
24
24
  };
25
25
  const useGmapGeometry = () => {
26
26
  const payload = useMapSupplier();
@@ -39,14 +39,14 @@ const useGmapGeometry = () => {
39
39
  return void 0;
40
40
  return google.maps.geometry.spherical.computeLength(line.map(vec2lnglat));
41
41
  };
42
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
43
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
42
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
44
43
  };
45
44
  const useMapGeometry = () => {
46
45
  const { supplier } = useMapSupplier();
47
46
  return supplier === "gmap" ? useGmapGeometry() : useAmapGeometry();
48
47
  };
49
48
  export {
49
+ apiLocalIsPointInRing,
50
50
  useAmapGeometry,
51
51
  useGmapGeometry,
52
52
  useMapGeometry
@@ -31,32 +31,37 @@ const useAmapPlace = (props) => {
31
31
  };
32
32
  const getPlaceByRegeo = abortable(([lng, lat]) => {
33
33
  return new Promise((resolve) => {
34
- const geocoder = new AMap.Geocoder({ lang: language === "en" ? "en" : "zh_cn" });
35
- const pipeTw = createPipeTw(language === "zh-TW");
36
- const isChina = inChina([lng, lat]);
37
- geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
38
- switch (status) {
39
- case "complete": {
40
- const { formattedAddress, addressComponent } = result.regeocode;
41
- const name = formattedAddress ? formattedAddress : emptyPlaceName;
42
- const displayName = amapPlaceName2DisplayName(name, { isChina, ...addressComponent });
43
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
44
- return;
45
- }
46
- case "no_data":
47
- case "error": {
48
- const name = emptyPlaceName;
49
- const displayName = emptyPlaceName;
50
- resolve({ lng, lat, name, displayName });
51
- return;
52
- }
53
- }
54
- });
55
- setTimeout(() => {
56
- console.warn("高德逆地理请求超时!");
34
+ const handleFailed = () => {
57
35
  const name = emptyPlaceName;
58
36
  const displayName = emptyPlaceName;
59
37
  resolve({ lng, lat, name, displayName });
38
+ };
39
+ readyPromise.then(() => {
40
+ const geocoder = new AMap.Geocoder({ lang: language === "en" ? "en" : "zh_cn" });
41
+ const pipeTw = createPipeTw(language === "zh-TW");
42
+ const isChina = inChina([lng, lat]);
43
+ geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
44
+ switch (status) {
45
+ case "complete": {
46
+ const { formattedAddress, addressComponent } = result.regeocode;
47
+ const name = formattedAddress ? formattedAddress : emptyPlaceName;
48
+ const displayName = amapPlaceName2DisplayName(name, {
49
+ isChina,
50
+ ...addressComponent
51
+ });
52
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
53
+ return;
54
+ }
55
+ case "no_data":
56
+ case "error": {
57
+ handleFailed();
58
+ }
59
+ }
60
+ });
61
+ }, handleFailed);
62
+ setTimeout(() => {
63
+ console.warn("高德逆地理请求超时!");
64
+ handleFailed();
60
65
  }, REGEO_TIMEOUT);
61
66
  });
62
67
  });
@@ -96,23 +101,25 @@ const useGmapPlace = (props) => {
96
101
  };
97
102
  const getPlaceByRegeo = abortable(([lng, lat]) => {
98
103
  return new Promise((resolve) => {
99
- const geocoder = new google.maps.Geocoder();
100
- const pipeTw = createPipeTw(language === "zh-TW");
101
- geocoder.geocode({ language, location: { lng, lat } }).then(({ results }) => {
102
- const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
103
- const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
104
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
105
- }).catch((err) => {
106
- console.error(err);
104
+ const handleFailed = (err) => {
105
+ if (err)
106
+ console.error(err);
107
107
  const name = emptyPlaceName;
108
108
  const displayName = emptyPlaceName;
109
109
  resolve({ lng, lat, name, displayName });
110
- });
110
+ };
111
+ readyPromise.then(() => {
112
+ const geocoder = new google.maps.Geocoder();
113
+ const pipeTw = createPipeTw(language === "zh-TW");
114
+ geocoder.geocode({ language, location: { lng, lat } }).then(({ results }) => {
115
+ const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
116
+ const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
117
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
118
+ }).catch(handleFailed);
119
+ }, handleFailed);
111
120
  setTimeout(() => {
112
121
  console.warn("谷歌逆地理请求超时!");
113
- const name = emptyPlaceName;
114
- const displayName = emptyPlaceName;
115
- resolve({ lng, lat, name, displayName });
122
+ handleFailed();
116
123
  }, REGEO_TIMEOUT);
117
124
  });
118
125
  });
@@ -3,7 +3,7 @@ import { GET_RECOMMEND_PLACE_TIMEOUT } from "../api/contants.js";
3
3
  import { logNoneManualAbortError } from "../utils/ManualAbortError.js";
4
4
  import { equalAssign, createAbortable, isPlacesInclude } from "../utils/helper.js";
5
5
  import { isZoneEqual, place2point, isPlaceEqual, businessCandidatesToAdsorptionPlace } from "../utils/transform.js";
6
- import { useMapGeometry } from "./useMapGeometry.js";
6
+ import { useMapGeometry, apiLocalIsPointInRing } from "./useMapGeometry.js";
7
7
  import { useMapPlace } from "./useMapPlace.js";
8
8
  function mergeGetRecommendPlaceAndGetAvailable(getRecomendPlace, getAvailable, timeout) {
9
9
  return function mergedGetRecommendPlace(place, context) {
@@ -53,7 +53,7 @@ const useMapRecomendPlace = (props) => {
53
53
  const placeCandidatesRef = ref([]);
54
54
  const zoneRef = ref();
55
55
  const abortable = createAbortable(signal);
56
- const { apiMapIsPointInRing, apiMapDistance } = useMapGeometry();
56
+ const { apiMapDistance } = useMapGeometry();
57
57
  const { getPlaceByRegeo } = useMapPlace({
58
58
  emptyPlaceName,
59
59
  pointRef: ref([...defaultPoint]),
@@ -99,7 +99,7 @@ const useMapRecomendPlace = (props) => {
99
99
  async (point, prevState) => {
100
100
  const [lng, lat] = point;
101
101
  const zone = zoneRef.value;
102
- if (!zone || !apiMapIsPointInRing(point, zone.path)) {
102
+ if (!zone || !apiLocalIsPointInRing(point, zone.path)) {
103
103
  const reGeoPlacePromise = getPlaceByRegeo(point);
104
104
  const {
105
105
  place: closestPlace,
@@ -130,7 +130,7 @@ const useMapRecomendPlace = (props) => {
130
130
  );
131
131
  const updateIntermediateQueryingState = (point) => {
132
132
  const zone = zoneRef.value;
133
- if (zone && apiMapIsPointInRing(point, zone.path))
133
+ if (zone && apiLocalIsPointInRing(point, zone.path))
134
134
  return;
135
135
  const [lng, lat] = point;
136
136
  const intermediateQueryingPlace = {
@@ -1,5 +1,5 @@
1
1
  import { reactive, ref, readonly } from "vue-demi";
2
- import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.f589ebf7.js";
2
+ import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.4b641c71.js";
3
3
  import { CenterPlaceStatus } from "../types/interface.js";
4
4
  import { proxyFunctionalProperty, assertAssingedBeforeUsed } from "../utils/helper.js";
5
5
  const useBusinessRecomendPlaceMap = () => {
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.f589ebf7.js";
5
+ import { B } from "./chunks/BusinessRecomendPlaceMap.4b641c71.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 = "2.0.0-switchMap3";
3
+ const pkgVersion = "2.0.0-switchMap4";
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.86e9c287.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.4befb6c7.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";
@@ -26,7 +26,7 @@ import "../GreenZone/GreenZone.js";
26
26
  import "../PassengerCircle/PassengerCircle.js";
27
27
  import "../PickupPoints/PickupPoints.js";
28
28
  import "./useCacheCenterPlace.js";
29
- import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.86e9c287.js";
29
+ import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.4befb6c7.js";
30
30
  export {
31
31
  B as BusinessRecomendPlaceMap,
32
32
  f as BusinessRecomendPlaceMapInner,
@@ -1,4 +1,4 @@
1
- import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.86e9c287.js";
1
+ import { B, f, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.4befb6c7.js";
2
2
  export {
3
3
  B as BusinessRecomendPlaceMap,
4
4
  f as BusinessRecomendPlaceMapInner,
@@ -20,7 +20,7 @@ import { detectBrowserPlatform } from "../../utils/platform.js";
20
20
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
21
21
  import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
22
22
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
23
- 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.86e9c287.js";
23
+ 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.4befb6c7.js";
24
24
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
25
25
  import { GreenZone } from "../GreenZone/GreenZone.js";
26
26
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
@@ -316,7 +316,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
316
316
  defaultValue: DEFAULT_ZOOM
317
317
  });
318
318
  const {
319
- readyPromise
319
+ readyPromise,
320
+ supplier
320
321
  } = useMapSupplier();
321
322
  const {
322
323
  assertSupplier
@@ -400,7 +401,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
400
401
  if (!isFirstLoad)
401
402
  return;
402
403
  const [lng, lat] = value.position;
403
- await readyPromise;
404
+ if (supplier === "amap")
405
+ await readyPromise;
404
406
  centerSource.source = "geo";
405
407
  centerPlace.lng = lng;
406
408
  centerPlace.lat = lat;
@@ -410,7 +412,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
410
412
  emit("loadDefaultGeoLocation", coordinatifyGeoPosition(value));
411
413
  if (!isFirstLoad)
412
414
  return;
413
- await readyPromise;
415
+ if (supplier === "amap")
416
+ await readyPromise;
414
417
  centerSource.source = "geo";
415
418
  updatePlace(value.position);
416
419
  },
@@ -1,17 +1,17 @@
1
- import "../css/Loading-0e058b68.css";
1
+ import "../css/Loading-49e58ced.css";
2
2
  import { createVNode } from "vue";
3
3
  import { ICON_LOAD_FAILED_URL } from "../api/cdn.js";
4
4
  import { AbsoluteAddressBox } from "../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
5
5
  import { defineSetup } from "../types/helper.js";
6
6
  const imgGrid = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzg1IiBoZWlnaHQ9IjgxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBzdHJva2U9IiNEOERCRTIiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWRhc2hhcnJheT0iMSI+PHBhdGggZD0iTS41IDgxN1YwTTI0LjUgODE3VjBNNDguNSA4MTdWME03Mi41IDgxN1YwTTk2LjUgODE3VjBNMTIwLjUgODE3VjBNMTQ0LjUgODE3VjBNMTY4LjUgODE3VjBNMTkyLjUgODE3VjBNMjE2LjUgODE3VjBNMjQwLjUgODE3VjBNMjY0LjUgODE3VjBNMjg4LjUgODE3VjBNMzEyLjUgODE3VjBNMzM2LjUgODE3VjBNMzYwLjUgODE3VjBNMzg0LjUgODE3VjBNMCAuNWgzODVNMCAyNC41aDM4NU0wIDQ4LjVoMzg1TTAgNzIuNWgzODVNMCA5Ni41aDM4NU0wIDEyMC41aDM4NU0wIDE0NC41aDM4NU0wIDE2OC41aDM4NU0wIDE5Mi41aDM4NU0wIDIxNi41aDM4NU0wIDI0MC41aDM4NU0wIDI2NC41aDM4NU0wIDI4OC41aDM4NU0wIDMxMi41aDM4NU0wIDMzNi41aDM4NU0wIDM2MC41aDM4NU0wIDM4NC41aDM4NU0wIDQwOC41aDM4NU0wIDQzMi41aDM4NU0wIDQ1Ni41aDM4NU0wIDQ4MC41aDM4NU0wIDUwNC41aDM4NU0wIDUyOC41aDM4NU0wIDU1Mi41aDM4NU0wIDU3Ni41aDM4NU0wIDYwMC41aDM4NU0wIDYyNC41aDM4NU0wIDY0OC41aDM4NU0wIDY3Mi41aDM4NU0wIDY5Ni41aDM4NU0wIDcyMC41aDM4NU0wIDc0NC41aDM4NU0wIDc2OC41aDM4NU0wIDc5Mi41aDM4NU0wIDgxNi41aDM4NSIvPjwvZz48L3N2Zz4=";
7
7
  const Loading_css_ts_vanilla = "";
8
+ var contentLayout = "_17ify492";
8
9
  var description = "_17ify496";
9
- var iconLayout = "_17ify492";
10
10
  var iconLoadFailed = "_17ify493";
11
11
  var loadingBg = "_17ify491";
12
12
  var loadingLayout = "_17ify490";
13
- var textLayout = "_17ify494";
14
13
  var title = "_17ify495";
14
+ var verticalGap = "_17ify494";
15
15
  const Loading = defineSetup("Loading", function() {
16
16
  return () => createVNode("div", {
17
17
  "class": loadingLayout
@@ -30,17 +30,15 @@ const LoadFailed = defineSetup("LoadFailed", function(props) {
30
30
  "class": loadingBg,
31
31
  "src": imgGrid
32
32
  }, null), createVNode("div", {
33
- "class": iconLayout
33
+ "class": contentLayout
34
34
  }, [createVNode("img", {
35
35
  "class": iconLoadFailed,
36
36
  "src": ICON_LOAD_FAILED_URL
37
- }, null), createVNode("div", {
38
- "class": textLayout
39
- }, [createVNode("span", {
40
- "class": title
37
+ }, null), createVNode("span", {
38
+ "class": `${title} ${verticalGap}`
41
39
  }, [props.title]), createVNode("span", {
42
- "class": description
43
- }, [props.description])])])]);
40
+ "class": `${description} ${verticalGap}`
41
+ }, [props.description])])]);
44
42
  });
45
43
  export {
46
44
  Loading as L,
@@ -1,7 +1,7 @@
1
1
  export declare const loadingLayout: string;
2
2
  export declare const loadingBg: string;
3
- export declare const iconLayout: string;
3
+ export declare const contentLayout: string;
4
4
  export declare const iconLoadFailed: string;
5
- export declare const textLayout: string;
5
+ export declare const verticalGap: string;
6
6
  export declare const title: string;
7
7
  export declare const description: string;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
2
  import "../../api/cdn.js";
3
- import { a, L } from "../../chunks/Loading.98d687c0.js";
3
+ import { a, L } from "../../chunks/Loading.32ae3c98.js";
4
4
  import "../../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
5
5
  import "../../types/helper.js";
6
6
  export {
@@ -1,4 +1,4 @@
1
- import { a, L } from "../../chunks/Loading.98d687c0.js";
1
+ import { a, L } from "../../chunks/Loading.32ae3c98.js";
2
2
  export {
3
3
  a as LoadFailed,
4
4
  L as Loading
@@ -1,6 +1,6 @@
1
1
  import "../../css/MapProvider-156bfd53.css";
2
2
  import { createVNode, isVNode } from "vue";
3
- import { L as Loading, a as LoadFailed, i as imgGrid } from "../../chunks/Loading.98d687c0.js";
3
+ import { L as Loading, a as LoadFailed, i as imgGrid } from "../../chunks/Loading.32ae3c98.js";
4
4
  import { useMapLoader, Status } from "../../hooks/useMapLoader.js";
5
5
  import { provideMapSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
6
6
  import { defineLagecySetup } from "../../types/helper.js";
@@ -3,6 +3,7 @@
3
3
  background-color: #EDF1F5;
4
4
  }
5
5
  ._17ify491 {
6
+ position: absolute;
6
7
  width: 100%;
7
8
  height: 100%;
8
9
  object-fit: cover;
@@ -10,29 +11,24 @@
10
11
  ._17ify492 {
11
12
  position: absolute;
12
13
  margin: auto;
13
- top: 0;
14
+ top: -5vh;
14
15
  left: 0;
15
16
  right: 0;
16
17
  bottom: 0;
17
18
  width: fit-content;
18
19
  height: fit-content;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
19
23
  }
20
24
  ._17ify493 {
21
25
  width: 40.8vw;
22
26
  height: 24.53vw;
23
27
  }
24
28
  ._17ify494 {
25
- position: absolute;
26
- top: 100%;
27
- display: flex;
28
- flex-direction: column;
29
- align-items: center;
30
- width: max-content;
31
- left: 50%;
32
- transform: translate(-50%, 0);
29
+ margin-top: 1.6vw;
33
30
  }
34
31
  ._17ify495 {
35
- margin-top: 1.6vw;
36
32
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
37
33
  font-weight: 500;
38
34
  font-size: 4vw;
@@ -40,7 +36,6 @@
40
36
  line-height: 6.4vw;
41
37
  }
42
38
  ._17ify496 {
43
- margin-top: 1.6vw;
44
39
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
45
40
  font-weight: 400;
46
41
  font-size: 3.73vw;
@@ -565,7 +565,6 @@ const useAmapGCJ02 = () => {
565
565
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
566
566
  };
567
567
  const useGmapGCJ02 = () => {
568
- const { readyPromise } = useMapSupplier();
569
568
  const toCoordinateType = (p) => {
570
569
  return inChina(p) && !inHongkong(p) && !inMacau(p) ? "gcj02" : "wgs84";
571
570
  };
@@ -583,11 +582,9 @@ const useGmapGCJ02 = () => {
583
582
  };
584
583
  const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
585
584
  const toGcj02 = async (point) => {
586
- await readyPromise;
587
585
  return toLocalGcj02Points([point])[0];
588
586
  };
589
587
  const toGcj02Points = async (points) => {
590
- await readyPromise;
591
588
  return toLocalGcj02Points(points);
592
589
  };
593
590
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
@@ -1,19 +1,17 @@
1
1
  import type { Point } from "../types/interface";
2
+ export declare const apiLocalIsPointInRing: (point: Point, path: Point[]) => boolean;
2
3
  export declare const useAmapGeometry: () => {
3
4
  apiMapDistance: (from: Point, to: Point) => number | undefined;
4
5
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
5
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
6
6
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
7
7
  };
8
8
  export declare const useGmapGeometry: () => {
9
9
  apiMapDistance: (from: Point, to: Point) => number | undefined;
10
10
  apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
11
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
12
11
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
13
12
  };
14
13
  export declare const useMapGeometry: () => {
15
14
  apiMapDistance: (from: Point, to: Point) => number | undefined;
16
15
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
17
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
18
16
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
19
17
  };
@@ -2,6 +2,7 @@ import { pointInPolygon } from "../utils/geometryPolygon.js";
2
2
  import { vec2lnglat } from "../utils/transform.js";
3
3
  import { Status } from "./useMapLoader.js";
4
4
  import { useMapSupplier } from "./useMapSupplier.js";
5
+ const apiLocalIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
5
6
  const useAmapGeometry = () => {
6
7
  const payload = useMapSupplier();
7
8
  const apiMapDistance = (from, to) => {
@@ -19,8 +20,7 @@ const useAmapGeometry = () => {
19
20
  return void 0;
20
21
  return AMap.GeometryUtil.distanceOfLine(line);
21
22
  };
22
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
23
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
23
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
24
24
  };
25
25
  const useGmapGeometry = () => {
26
26
  const payload = useMapSupplier();
@@ -39,14 +39,14 @@ const useGmapGeometry = () => {
39
39
  return void 0;
40
40
  return google.maps.geometry.spherical.computeLength(line.map(vec2lnglat));
41
41
  };
42
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
43
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
42
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
44
43
  };
45
44
  const useMapGeometry = () => {
46
45
  const { supplier } = useMapSupplier();
47
46
  return supplier === "gmap" ? useGmapGeometry() : useAmapGeometry();
48
47
  };
49
48
  export {
49
+ apiLocalIsPointInRing,
50
50
  useAmapGeometry,
51
51
  useGmapGeometry,
52
52
  useMapGeometry
@@ -31,32 +31,37 @@ const useAmapPlace = (props) => {
31
31
  };
32
32
  const getPlaceByRegeo = abortable(([lng, lat]) => {
33
33
  return new Promise((resolve) => {
34
- const geocoder = new AMap.Geocoder({ lang: language === "en" ? "en" : "zh_cn" });
35
- const pipeTw = createPipeTw(language === "zh-TW");
36
- const isChina = inChina([lng, lat]);
37
- geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
38
- switch (status) {
39
- case "complete": {
40
- const { formattedAddress, addressComponent } = result.regeocode;
41
- const name = formattedAddress ? formattedAddress : emptyPlaceName;
42
- const displayName = amapPlaceName2DisplayName(name, { isChina, ...addressComponent });
43
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
44
- return;
45
- }
46
- case "no_data":
47
- case "error": {
48
- const name = emptyPlaceName;
49
- const displayName = emptyPlaceName;
50
- resolve({ lng, lat, name, displayName });
51
- return;
52
- }
53
- }
54
- });
55
- setTimeout(() => {
56
- console.warn("高德逆地理请求超时!");
34
+ const handleFailed = () => {
57
35
  const name = emptyPlaceName;
58
36
  const displayName = emptyPlaceName;
59
37
  resolve({ lng, lat, name, displayName });
38
+ };
39
+ readyPromise.then(() => {
40
+ const geocoder = new AMap.Geocoder({ lang: language === "en" ? "en" : "zh_cn" });
41
+ const pipeTw = createPipeTw(language === "zh-TW");
42
+ const isChina = inChina([lng, lat]);
43
+ geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
44
+ switch (status) {
45
+ case "complete": {
46
+ const { formattedAddress, addressComponent } = result.regeocode;
47
+ const name = formattedAddress ? formattedAddress : emptyPlaceName;
48
+ const displayName = amapPlaceName2DisplayName(name, {
49
+ isChina,
50
+ ...addressComponent
51
+ });
52
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
53
+ return;
54
+ }
55
+ case "no_data":
56
+ case "error": {
57
+ handleFailed();
58
+ }
59
+ }
60
+ });
61
+ }, handleFailed);
62
+ setTimeout(() => {
63
+ console.warn("高德逆地理请求超时!");
64
+ handleFailed();
60
65
  }, REGEO_TIMEOUT);
61
66
  });
62
67
  });
@@ -96,23 +101,25 @@ const useGmapPlace = (props) => {
96
101
  };
97
102
  const getPlaceByRegeo = abortable(([lng, lat]) => {
98
103
  return new Promise((resolve) => {
99
- const geocoder = new google.maps.Geocoder();
100
- const pipeTw = createPipeTw(language === "zh-TW");
101
- geocoder.geocode({ language, location: { lng, lat } }).then(({ results }) => {
102
- const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
103
- const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
104
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
105
- }).catch((err) => {
106
- console.error(err);
104
+ const handleFailed = (err) => {
105
+ if (err)
106
+ console.error(err);
107
107
  const name = emptyPlaceName;
108
108
  const displayName = emptyPlaceName;
109
109
  resolve({ lng, lat, name, displayName });
110
- });
110
+ };
111
+ readyPromise.then(() => {
112
+ const geocoder = new google.maps.Geocoder();
113
+ const pipeTw = createPipeTw(language === "zh-TW");
114
+ geocoder.geocode({ language, location: { lng, lat } }).then(({ results }) => {
115
+ const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
116
+ const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
117
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
118
+ }).catch(handleFailed);
119
+ }, handleFailed);
111
120
  setTimeout(() => {
112
121
  console.warn("谷歌逆地理请求超时!");
113
- const name = emptyPlaceName;
114
- const displayName = emptyPlaceName;
115
- resolve({ lng, lat, name, displayName });
122
+ handleFailed();
116
123
  }, REGEO_TIMEOUT);
117
124
  });
118
125
  });
@@ -3,7 +3,7 @@ import { GET_RECOMMEND_PLACE_TIMEOUT } from "../api/contants.js";
3
3
  import { logNoneManualAbortError } from "../utils/ManualAbortError.js";
4
4
  import { equalAssign, createAbortable, isPlacesInclude } from "../utils/helper.js";
5
5
  import { isZoneEqual, place2point, isPlaceEqual, businessCandidatesToAdsorptionPlace } from "../utils/transform.js";
6
- import { useMapGeometry } from "./useMapGeometry.js";
6
+ import { useMapGeometry, apiLocalIsPointInRing } from "./useMapGeometry.js";
7
7
  import { useMapPlace } from "./useMapPlace.js";
8
8
  function mergeGetRecommendPlaceAndGetAvailable(getRecomendPlace, getAvailable, timeout) {
9
9
  return function mergedGetRecommendPlace(place, context) {
@@ -53,7 +53,7 @@ const useMapRecomendPlace = (props) => {
53
53
  const placeCandidatesRef = ref([]);
54
54
  const zoneRef = ref();
55
55
  const abortable = createAbortable(signal);
56
- const { apiMapIsPointInRing, apiMapDistance } = useMapGeometry();
56
+ const { apiMapDistance } = useMapGeometry();
57
57
  const { getPlaceByRegeo } = useMapPlace({
58
58
  emptyPlaceName,
59
59
  pointRef: ref([...defaultPoint]),
@@ -99,7 +99,7 @@ const useMapRecomendPlace = (props) => {
99
99
  async (point, prevState) => {
100
100
  const [lng, lat] = point;
101
101
  const zone = zoneRef.value;
102
- if (!zone || !apiMapIsPointInRing(point, zone.path)) {
102
+ if (!zone || !apiLocalIsPointInRing(point, zone.path)) {
103
103
  const reGeoPlacePromise = getPlaceByRegeo(point);
104
104
  const {
105
105
  place: closestPlace,
@@ -130,7 +130,7 @@ const useMapRecomendPlace = (props) => {
130
130
  );
131
131
  const updateIntermediateQueryingState = (point) => {
132
132
  const zone = zoneRef.value;
133
- if (zone && apiMapIsPointInRing(point, zone.path))
133
+ if (zone && apiLocalIsPointInRing(point, zone.path))
134
134
  return;
135
135
  const [lng, lat] = point;
136
136
  const intermediateQueryingPlace = {
@@ -1,5 +1,5 @@
1
1
  import { reactive, ref, readonly } from "vue-demi";
2
- import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.86e9c287.js";
2
+ import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.4befb6c7.js";
3
3
  import { CenterPlaceStatus } from "../types/interface.js";
4
4
  import { proxyFunctionalProperty, assertAssingedBeforeUsed } from "../utils/helper.js";
5
5
  const useBusinessRecomendPlaceMap = () => {
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.86e9c287.js";
5
+ import { B } from "./chunks/BusinessRecomendPlaceMap.4befb6c7.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 = "2.0.0-switchMap3";
3
+ const pkgVersion = "2.0.0-switchMap4";
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": "2.0.0-switchMap3",
3
+ "version": "2.0.0-switchMap4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",