@heycar/heycars-map 0.9.27-google5 → 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.
@@ -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
  };
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-google5";
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}`);
@@ -90,13 +90,16 @@ function amapPlaceName2DisplayNameInChina(name, options) {
90
90
  if (neighborhood)
91
91
  return neighborhood;
92
92
  let result = name;
93
- for (const item of [province, city, district, township]) {
94
- const replacedName = result.replace(item, "");
95
- if (replacedName.length < 20)
96
- return replacedName;
97
- result = replacedName;
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
- return result;
99
+ if (result.length < 20)
100
+ return result;
101
+ const replacedName = result.replace(township, "");
102
+ return replacedName.trim() ? replacedName : result;
100
103
  }
101
104
  const NOT_ONLY_NUMBERS_REGEX = /[^\d\s-]/;
102
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-google5",
3
+ "version": "0.9.27-google6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js"