@heycar/heycars-map 0.9.27-google4 → 0.9.27-google6

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.
@@ -1,4 +1,4 @@
1
- import "../../css/PlaceCircle-2369f992.css";
1
+ import "../../css/PlaceCircle-3c051f4e.css";
2
2
  import { computed, h } from "vue";
3
3
  import "../../chunks/index.fbc1adc8.js";
4
4
  import { ZINDEX_PLACE_LAYER } from "../../api/contants.js";
@@ -4,6 +4,7 @@ import { useMapOverlay } from "../../hooks/useOverlay.js";
4
4
  import { defineSetup } from "../../types/helper.js";
5
5
  import { watchNoneImmediatePostEffectForMapProperty, watchPostEffectForAMapEvent } from "../../utils/compare.js";
6
6
  import { referenceCount } from "../../utils/referenceCount.js";
7
+ import { useAmapFixBugOverlayDrag } from "../AmapPolygon/AmapPolygon.js";
7
8
  import { shallowRef, onMounted, onUnmounted, watchPostEffect } from "vue";
8
9
  const AmapMarker = defineSetup(function AmapMarker2(props, { emit }) {
9
10
  const { registerOverlay } = props;
@@ -21,6 +22,7 @@ const AmapMarker = defineSetup(function AmapMarker2(props, { emit }) {
21
22
  (_b = markerRef.value) == null ? void 0 : _b.destroy();
22
23
  markerRef.value = void 0;
23
24
  });
25
+ useAmapFixBugOverlayDrag(markerRef);
24
26
  watchPostEffect((onCleanup) => {
25
27
  var _a;
26
28
  const map = mapRef == null ? void 0 : mapRef.value;
@@ -1,3 +1,4 @@
1
+ import { type ShallowRef } from "vue-demi";
1
2
  import type { AMapEvent } from "../../types/mapHelper";
2
3
  export interface AmapPolygonProps extends AMap.PolygonOptions {
3
4
  onTouchStart?: (e: AMapEvent<AMap.Polygon>) => void;
@@ -5,3 +6,4 @@ export interface AmapPolygonProps extends AMap.PolygonOptions {
5
6
  onTouchEnd?: (e: AMapEvent<AMap.Polygon>) => void;
6
7
  }
7
8
  export declare const AmapPolygon: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapPolygonProps>, 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<AmapPolygonProps, Required<AmapPolygonProps>>, "touchStart" | "touchMove" | "touchEnd", AmapPolygonProps>;
9
+ export declare const useAmapFixBugOverlayDrag: (overlayRef?: ShallowRef<AMap.Polygon | AMap.Marker | undefined>) => void;
@@ -19,7 +19,7 @@ const AmapPolygon = defineSetup(function AmapPolygon2(props) {
19
19
  (_b = polygonRef.value) == null ? void 0 : _b.destroy();
20
20
  polygonRef.value = void 0;
21
21
  });
22
- useAmapFixBugPolygonDrag(polygonRef);
22
+ useAmapFixBugOverlayDrag(polygonRef);
23
23
  watchPostEffect((onCleanup) => {
24
24
  var _a;
25
25
  const map = mapRef == null ? void 0 : mapRef.value;
@@ -48,7 +48,7 @@ const AmapPolygon = defineSetup(function AmapPolygon2(props) {
48
48
  );
49
49
  return () => null;
50
50
  });
51
- const useAmapFixBugPolygonDrag = (polygonRef) => {
51
+ const useAmapFixBugOverlayDrag = (overlayRef) => {
52
52
  let dragStatus = "UNSTARTED";
53
53
  const onTouchStart = () => {
54
54
  dragStatus = "WAITING_DRAG_START";
@@ -70,21 +70,22 @@ const useAmapFixBugPolygonDrag = (polygonRef) => {
70
70
  amap == null ? void 0 : amap.emit("dragend", { type: "dragend", target: amap, lnglat, pixel, originEvent });
71
71
  };
72
72
  watchPostEffectForAMapEvent(
73
- polygonRef,
73
+ overlayRef,
74
74
  {},
75
75
  onTouchStart,
76
76
  ["onTouchStart"]
77
77
  );
78
78
  watchPostEffectForAMapEvent(
79
- polygonRef,
79
+ overlayRef,
80
80
  {},
81
81
  onTouchMove,
82
82
  ["onTouchMove"]
83
83
  );
84
- watchPostEffectForAMapEvent(polygonRef, {}, onTouchEnd, [
84
+ watchPostEffectForAMapEvent(overlayRef, {}, onTouchEnd, [
85
85
  "onTouchEnd"
86
86
  ]);
87
87
  };
88
88
  export {
89
- AmapPolygon
89
+ AmapPolygon,
90
+ useAmapFixBugOverlayDrag
90
91
  };
@@ -1,4 +1,5 @@
1
- import { AmapPolygon } from "./AmapPolygon.js";
1
+ import { AmapPolygon, useAmapFixBugOverlayDrag } from "./AmapPolygon.js";
2
2
  export {
3
- AmapPolygon
3
+ AmapPolygon,
4
+ useAmapFixBugOverlayDrag
4
5
  };
@@ -12,7 +12,6 @@
12
12
  margin-left: -2.265vw;
13
13
  }
14
14
  .fhyw85 {
15
- margin-bottom: -2.265vw;
16
15
  width: max-content;
17
16
  }
18
17
  .fhyw86 {
package/dist/utils/log.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "0.9.27-google4";
3
+ const pkgVersion = "0.9.27-google6";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -77,7 +77,6 @@ const isGeoPositionEqual = (p1, p2) => {
77
77
  const isZoneEqual = (z1, z2) => {
78
78
  return z1.path.every((point, idx) => isPointEqual(point, z2 == null ? void 0 : z2.path[idx]));
79
79
  };
80
- const ILLEGAL_DISPLAY_NAME_WITHOUT_STREET_NUMBER_REGEX = /(?:^\s*$|\(\)|())/;
81
80
  const amapPlaceName2DisplayName = (name, options) => {
82
81
  const { isChina } = options;
83
82
  if (!name)
@@ -85,19 +84,22 @@ const amapPlaceName2DisplayName = (name, options) => {
85
84
  return isChina ? amapPlaceName2DisplayNameInChina(name, options) : amapPlaceName2DisplayNameOutChina(name, options);
86
85
  };
87
86
  function amapPlaceName2DisplayNameInChina(name, options) {
88
- const { province, city, district, township, building, neighborhood, street, streetNumber } = options;
87
+ const { province, city, district, township, building, neighborhood } = options;
89
88
  if (building)
90
89
  return building;
91
90
  if (neighborhood)
92
91
  return neighborhood;
93
92
  let result = name;
94
- for (const item of [province, city, district, township]) {
95
- if (result.trim() === item)
96
- return item;
97
- result = result.replace(item, "");
93
+ for (const item of [province, city, district]) {
94
+ const replacedName2 = result.replace(item, "");
95
+ if (!replacedName2.trim())
96
+ return result;
97
+ result = replacedName2;
98
98
  }
99
- const resultWithoutStreetNumber = result.replace(street, "").replace(streetNumber, "");
100
- return ILLEGAL_DISPLAY_NAME_WITHOUT_STREET_NUMBER_REGEX.test(resultWithoutStreetNumber) ? result : resultWithoutStreetNumber;
99
+ if (result.length < 20)
100
+ return result;
101
+ const replacedName = result.replace(township, "");
102
+ return replacedName.trim() ? replacedName : result;
101
103
  }
102
104
  const NOT_ONLY_NUMBERS_REGEX = /[^\d\s-]/;
103
105
  function amapPlaceName2DisplayNameOutChina(name, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.9.27-google4",
3
+ "version": "0.9.27-google6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js"