@heycar/heycars-map 0.5.7 → 0.5.9

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.
@@ -17,5 +17,6 @@ export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
17
17
  onDragEnd?: MapEventHandler<AMap.Map>;
18
18
  onZoomEnd?: MapEventHandler<AMap.Map>;
19
19
  onResize?: MapEventHandler<AMap.Map>;
20
+ onMoveend?: MapEventHandler<AMap.Map>;
20
21
  }
21
- export declare const Amap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapProps>, 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<AmapProps, Required<AmapProps>>, "resize" | "dragStart" | "dragEnd" | "zoomEnd", AmapProps, {}>;
22
+ export declare const Amap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapProps>, 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<AmapProps, Required<AmapProps>>, "resize" | "moveend" | "dragStart" | "dragEnd" | "zoomEnd", AmapProps, {}>;
@@ -2,6 +2,7 @@
2
2
  import { type ShallowRef } from "vue-demi";
3
3
  import type { Point } from "../types/interface";
4
4
  export declare const ON_CHANGE_CENTER_INTERVAL = 200;
5
+ export declare const DRAGEND_DETECTING_ANIMATION_DELAY = 50;
5
6
  export interface UseMapDragProps<M = AMap.Map | google.maps.Map> {
6
7
  mapRef: ShallowRef<M | undefined>;
7
8
  onChange?: (value: Point) => any;
@@ -1,6 +1,6 @@
1
1
  import { Ref } from "vue-demi";
2
2
  import type { Place, Point } from "../types/interface";
3
- export interface UseMapPlaceOnChangeCityProps {
3
+ export interface UseMapPlaceOnChangeCityProps extends Place {
4
4
  cityName?: string;
5
5
  cityParentName?: string;
6
6
  countryName?: string;
package/dist/index.cjs CHANGED
@@ -2113,7 +2113,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2113
2113
  "disableDoubleClickZoom": touchEnable,
2114
2114
  "gestureHandling": touchEnable ? "auto" : "none",
2115
2115
  "keyboardShortcuts": touchEnable,
2116
- "rotateControl": touchEnable,
2116
+ "rotateControl": false,
2117
2117
  "zoomControl": touchEnable,
2118
2118
  "scaleControl": touchEnable,
2119
2119
  "panControl": touchEnable
@@ -2131,7 +2131,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2131
2131
  "zoom": zoom,
2132
2132
  "dragEnable": touchEnable,
2133
2133
  "zoomEnable": touchEnable,
2134
- "rotateEnable": touchEnable,
2134
+ "rotateEnable": false,
2135
2135
  "doubleClickZoom": touchEnable,
2136
2136
  "scrollWheel": touchEnable,
2137
2137
  "touchZoom": touchEnable,
@@ -3164,29 +3164,56 @@ const useHeycarMap = () => {
3164
3164
  const { supplier } = useMapSupplier();
3165
3165
  return supplier === "gmap" ? useHeycarGamp() : useHeycarAmap();
3166
3166
  };
3167
+ const DRAGEND_DETECTING_ANIMATION_DELAY = 50;
3167
3168
  const useAmapDrag = (props) => {
3168
3169
  const { mapRef, onChange } = props;
3169
3170
  const centerRef = Vue.ref([0, 0]);
3170
3171
  const isDragging = Vue.ref(false);
3172
+ const isDragEndWaitingMovingEndRef = Vue.ref(false);
3173
+ let watchId = void 0;
3171
3174
  const emitDragStart = () => {
3172
3175
  pipeAsync(() => {
3173
3176
  isDragging.value = true;
3174
3177
  })();
3175
3178
  };
3176
- const emitDragEnd = (_, { target }) => {
3179
+ const handleDragEndWithAnimationEnd = (target) => {
3177
3180
  var _a;
3181
+ isDragEndWaitingMovingEndRef.value = false;
3178
3182
  isDragging.value = false;
3179
3183
  const { lng, lat } = target.getCenter();
3180
- spaceLog("dragEnd", "[lng, lat] = ", [lng, lat]);
3184
+ spaceLog("onDragEndWithAnimationEnd", "[lng, lat] = ", [lng, lat]);
3181
3185
  centerRef.value = [lng, lat];
3182
3186
  (_a = pipeAsync(onChange)) == null ? void 0 : _a([lng, lat]);
3183
3187
  };
3188
+ const emitDragEnd = (_, { target }) => {
3189
+ const { lng: baseLng, lat: baseLat } = target.getCenter();
3190
+ isDragEndWaitingMovingEndRef.value = true;
3191
+ if (watchId)
3192
+ clearTimeout(watchId);
3193
+ watchId = setTimeout(() => {
3194
+ watchId = void 0;
3195
+ const { lng, lat } = target.getCenter();
3196
+ if (!isDragEndWaitingMovingEndRef.value)
3197
+ return;
3198
+ if (baseLng !== lng || baseLat !== lat)
3199
+ return;
3200
+ handleDragEndWithAnimationEnd(target);
3201
+ }, DRAGEND_DETECTING_ANIMATION_DELAY);
3202
+ };
3203
+ const handleMoveEnd = (_, { target }) => {
3204
+ if (!isDragEndWaitingMovingEndRef.value)
3205
+ return;
3206
+ handleDragEndWithAnimationEnd(target);
3207
+ };
3184
3208
  watchPostEffectForAMapEvent(mapRef, {}, emitDragStart, [
3185
3209
  "onDragStart"
3186
3210
  ]);
3187
3211
  watchPostEffectForAMapEvent(mapRef, {}, emitDragEnd, [
3188
3212
  "onDragEnd"
3189
3213
  ]);
3214
+ watchPostEffectForAMapEvent(mapRef, {}, handleMoveEnd, [
3215
+ "onMoveend"
3216
+ ]);
3190
3217
  return { centerRef, isDragging };
3191
3218
  };
3192
3219
  const useGmapDrag = (props) => {
@@ -3243,10 +3270,11 @@ const useAmapPlace = (props) => {
3243
3270
  geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
3244
3271
  if (status !== "complete")
3245
3272
  return;
3246
- const { addressComponent } = result.regeocode;
3273
+ const { formattedAddress, addressComponent } = result.regeocode;
3274
+ const name = formattedAddress ? formattedAddress : emptyPlaceName;
3247
3275
  const cityName = addressComponent.city ? addressComponent.city : addressComponent.province;
3248
3276
  const cityParentName = addressComponent.province;
3249
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName: "" });
3277
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName: "" });
3250
3278
  });
3251
3279
  };
3252
3280
  const updatePlace = (value) => {
@@ -3275,7 +3303,7 @@ const useAmapPlace = (props) => {
3275
3303
  place.lng = lng;
3276
3304
  place.lat = lat;
3277
3305
  onChange == null ? void 0 : onChange({ lng, lat, name });
3278
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName: "" });
3306
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName: "" });
3279
3307
  return;
3280
3308
  }
3281
3309
  case "no_data":
@@ -3283,7 +3311,14 @@ const useAmapPlace = (props) => {
3283
3311
  place.lng = lng;
3284
3312
  place.lat = lat;
3285
3313
  onChange == null ? void 0 : onChange({ lng, lat, name: "" });
3286
- onChangeCity == null ? void 0 : onChangeCity({ cityName: "", cityParentName: "", countryName: "" });
3314
+ onChangeCity == null ? void 0 : onChangeCity({
3315
+ name: "",
3316
+ lng,
3317
+ lat,
3318
+ cityName: "",
3319
+ cityParentName: "",
3320
+ countryName: ""
3321
+ });
3287
3322
  return;
3288
3323
  case "error":
3289
3324
  throw result;
@@ -3317,10 +3352,11 @@ const useGmapPlace = (props) => {
3317
3352
  const geocoder = new google.maps.Geocoder();
3318
3353
  const { lng, lat } = value;
3319
3354
  const { results } = await geocoder.geocode({ language: LANGUAGE, location: { lng, lat } });
3355
+ const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
3320
3356
  const cityName = geocoderResult2cityName(results[0]);
3321
3357
  const cityParentName = results.slice(-2)[0].address_components[0].long_name;
3322
3358
  const countryName = results.slice(-1)[0].address_components[0].long_name;
3323
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName });
3359
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName });
3324
3360
  };
3325
3361
  Vue.watch(
3326
3362
  () => placeKey.value,
@@ -3337,7 +3373,7 @@ const useGmapPlace = (props) => {
3337
3373
  place.lat = lat;
3338
3374
  place.name = name;
3339
3375
  onChange == null ? void 0 : onChange({ lng, lat, name });
3340
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName });
3376
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName });
3341
3377
  }
3342
3378
  );
3343
3379
  return { place, updatePlace, setPlace, updateCity };
@@ -3549,25 +3585,6 @@ const useMapZoom = (props) => {
3549
3585
  const { supplier } = useMapSupplier();
3550
3586
  return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
3551
3587
  };
3552
- const useWaitTimer = (props) => {
3553
- const { interval } = props;
3554
- let timer = void 0;
3555
- const timerStop = {
3556
- promise: Promise.resolve(),
3557
- resolve: void 0
3558
- };
3559
- const timerStart = () => {
3560
- var _a;
3561
- if (timer)
3562
- clearTimeout(timer);
3563
- (_a = timerStop.resolve) == null ? void 0 : _a.call(timerStop);
3564
- timerStop.promise = new Promise((resolve) => {
3565
- timerStop.resolve = resolve;
3566
- timer = setTimeout(resolve, interval);
3567
- });
3568
- };
3569
- return { timerStart, timerStop };
3570
- };
3571
3588
  const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaWdodD0iNjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTcuMSUiIHk9Ii03LjElIiB3aWR0aD0iMTE0LjMlIiBoZWlnaHQ9IjExNC4zJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249Ii41I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901,7 +3918,6 @@ const useFirstWorkflowRecomendLoading = () => {
3901
3918
  };
3902
3919
  const RECOMMEND_PLACE_DRAG_LIMIT = 10;
3903
3920
  const RECOMMEND_PLACE_LARGE_LIMIT = 100;
3904
- const MAP_DRAG_END_WAIT_ANIMATION = 500;
3905
3921
  const RECOMMEND_PLACE_ZOOM_MIN = 13;
3906
3922
  const DEFAULT_PLACE_NAME = "当前位置";
3907
3923
  const DEFAULT_ZOOM = 8;
@@ -3933,12 +3949,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
3933
3949
  mapRef,
3934
3950
  defaultValue: DEFAULT_ZOOM
3935
3951
  });
3936
- const {
3937
- timerStart,
3938
- timerStop
3939
- } = useWaitTimer({
3940
- interval: MAP_DRAG_END_WAIT_ANIMATION
3941
- });
3942
3952
  const {
3943
3953
  isFirstWorkflowRecomendLoadingRef,
3944
3954
  completeFirstWorkflowRecomend
@@ -4017,7 +4027,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
4017
4027
  mapRef,
4018
4028
  onChange: (point) => {
4019
4029
  centerSource.source = "drag";
4020
- timerStart();
4021
4030
  updatePlace(point);
4022
4031
  emit("changeByDrag", point);
4023
4032
  }
@@ -4055,7 +4064,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
4055
4064
  emit("changePlace", place);
4056
4065
  },
4057
4066
  onChange: async (place) => {
4058
- await timerStop.promise;
4059
4067
  centerSource.source = "recomend";
4060
4068
  Object.assign(centerPlace, {
4061
4069
  ...place
package/dist/index.js CHANGED
@@ -2111,7 +2111,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2111
2111
  "disableDoubleClickZoom": touchEnable,
2112
2112
  "gestureHandling": touchEnable ? "auto" : "none",
2113
2113
  "keyboardShortcuts": touchEnable,
2114
- "rotateControl": touchEnable,
2114
+ "rotateControl": false,
2115
2115
  "zoomControl": touchEnable,
2116
2116
  "scaleControl": touchEnable,
2117
2117
  "panControl": touchEnable
@@ -2129,7 +2129,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2129
2129
  "zoom": zoom,
2130
2130
  "dragEnable": touchEnable,
2131
2131
  "zoomEnable": touchEnable,
2132
- "rotateEnable": touchEnable,
2132
+ "rotateEnable": false,
2133
2133
  "doubleClickZoom": touchEnable,
2134
2134
  "scrollWheel": touchEnable,
2135
2135
  "touchZoom": touchEnable,
@@ -3162,29 +3162,56 @@ const useHeycarMap = () => {
3162
3162
  const { supplier } = useMapSupplier();
3163
3163
  return supplier === "gmap" ? useHeycarGamp() : useHeycarAmap();
3164
3164
  };
3165
+ const DRAGEND_DETECTING_ANIMATION_DELAY = 50;
3165
3166
  const useAmapDrag = (props) => {
3166
3167
  const { mapRef, onChange } = props;
3167
3168
  const centerRef = ref([0, 0]);
3168
3169
  const isDragging = ref(false);
3170
+ const isDragEndWaitingMovingEndRef = ref(false);
3171
+ let watchId = void 0;
3169
3172
  const emitDragStart = () => {
3170
3173
  pipeAsync(() => {
3171
3174
  isDragging.value = true;
3172
3175
  })();
3173
3176
  };
3174
- const emitDragEnd = (_, { target }) => {
3177
+ const handleDragEndWithAnimationEnd = (target) => {
3175
3178
  var _a;
3179
+ isDragEndWaitingMovingEndRef.value = false;
3176
3180
  isDragging.value = false;
3177
3181
  const { lng, lat } = target.getCenter();
3178
- spaceLog("dragEnd", "[lng, lat] = ", [lng, lat]);
3182
+ spaceLog("onDragEndWithAnimationEnd", "[lng, lat] = ", [lng, lat]);
3179
3183
  centerRef.value = [lng, lat];
3180
3184
  (_a = pipeAsync(onChange)) == null ? void 0 : _a([lng, lat]);
3181
3185
  };
3186
+ const emitDragEnd = (_, { target }) => {
3187
+ const { lng: baseLng, lat: baseLat } = target.getCenter();
3188
+ isDragEndWaitingMovingEndRef.value = true;
3189
+ if (watchId)
3190
+ clearTimeout(watchId);
3191
+ watchId = setTimeout(() => {
3192
+ watchId = void 0;
3193
+ const { lng, lat } = target.getCenter();
3194
+ if (!isDragEndWaitingMovingEndRef.value)
3195
+ return;
3196
+ if (baseLng !== lng || baseLat !== lat)
3197
+ return;
3198
+ handleDragEndWithAnimationEnd(target);
3199
+ }, DRAGEND_DETECTING_ANIMATION_DELAY);
3200
+ };
3201
+ const handleMoveEnd = (_, { target }) => {
3202
+ if (!isDragEndWaitingMovingEndRef.value)
3203
+ return;
3204
+ handleDragEndWithAnimationEnd(target);
3205
+ };
3182
3206
  watchPostEffectForAMapEvent(mapRef, {}, emitDragStart, [
3183
3207
  "onDragStart"
3184
3208
  ]);
3185
3209
  watchPostEffectForAMapEvent(mapRef, {}, emitDragEnd, [
3186
3210
  "onDragEnd"
3187
3211
  ]);
3212
+ watchPostEffectForAMapEvent(mapRef, {}, handleMoveEnd, [
3213
+ "onMoveend"
3214
+ ]);
3188
3215
  return { centerRef, isDragging };
3189
3216
  };
3190
3217
  const useGmapDrag = (props) => {
@@ -3241,10 +3268,11 @@ const useAmapPlace = (props) => {
3241
3268
  geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
3242
3269
  if (status !== "complete")
3243
3270
  return;
3244
- const { addressComponent } = result.regeocode;
3271
+ const { formattedAddress, addressComponent } = result.regeocode;
3272
+ const name = formattedAddress ? formattedAddress : emptyPlaceName;
3245
3273
  const cityName = addressComponent.city ? addressComponent.city : addressComponent.province;
3246
3274
  const cityParentName = addressComponent.province;
3247
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName: "" });
3275
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName: "" });
3248
3276
  });
3249
3277
  };
3250
3278
  const updatePlace = (value) => {
@@ -3273,7 +3301,7 @@ const useAmapPlace = (props) => {
3273
3301
  place.lng = lng;
3274
3302
  place.lat = lat;
3275
3303
  onChange == null ? void 0 : onChange({ lng, lat, name });
3276
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName: "" });
3304
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName: "" });
3277
3305
  return;
3278
3306
  }
3279
3307
  case "no_data":
@@ -3281,7 +3309,14 @@ const useAmapPlace = (props) => {
3281
3309
  place.lng = lng;
3282
3310
  place.lat = lat;
3283
3311
  onChange == null ? void 0 : onChange({ lng, lat, name: "" });
3284
- onChangeCity == null ? void 0 : onChangeCity({ cityName: "", cityParentName: "", countryName: "" });
3312
+ onChangeCity == null ? void 0 : onChangeCity({
3313
+ name: "",
3314
+ lng,
3315
+ lat,
3316
+ cityName: "",
3317
+ cityParentName: "",
3318
+ countryName: ""
3319
+ });
3285
3320
  return;
3286
3321
  case "error":
3287
3322
  throw result;
@@ -3315,10 +3350,11 @@ const useGmapPlace = (props) => {
3315
3350
  const geocoder = new google.maps.Geocoder();
3316
3351
  const { lng, lat } = value;
3317
3352
  const { results } = await geocoder.geocode({ language: LANGUAGE, location: { lng, lat } });
3353
+ const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
3318
3354
  const cityName = geocoderResult2cityName(results[0]);
3319
3355
  const cityParentName = results.slice(-2)[0].address_components[0].long_name;
3320
3356
  const countryName = results.slice(-1)[0].address_components[0].long_name;
3321
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName });
3357
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName });
3322
3358
  };
3323
3359
  watch(
3324
3360
  () => placeKey.value,
@@ -3335,7 +3371,7 @@ const useGmapPlace = (props) => {
3335
3371
  place.lat = lat;
3336
3372
  place.name = name;
3337
3373
  onChange == null ? void 0 : onChange({ lng, lat, name });
3338
- onChangeCity == null ? void 0 : onChangeCity({ cityName, cityParentName, countryName });
3374
+ onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName });
3339
3375
  }
3340
3376
  );
3341
3377
  return { place, updatePlace, setPlace, updateCity };
@@ -3547,25 +3583,6 @@ const useMapZoom = (props) => {
3547
3583
  const { supplier } = useMapSupplier();
3548
3584
  return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
3549
3585
  };
3550
- const useWaitTimer = (props) => {
3551
- const { interval } = props;
3552
- let timer = void 0;
3553
- const timerStop = {
3554
- promise: Promise.resolve(),
3555
- resolve: void 0
3556
- };
3557
- const timerStart = () => {
3558
- var _a;
3559
- if (timer)
3560
- clearTimeout(timer);
3561
- (_a = timerStop.resolve) == null ? void 0 : _a.call(timerStop);
3562
- timerStop.promise = new Promise((resolve) => {
3563
- timerStop.resolve = resolve;
3564
- timer = setTimeout(resolve, interval);
3565
- });
3566
- };
3567
- return { timerStart, timerStop };
3568
- };
3569
3586
  const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaWdodD0iNjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTcuMSUiIHk9Ii03LjElIiB3aWR0aD0iMTE0LjMlIiBoZWlnaHQ9IjExNC4zJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249Ii41IiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiLz48ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbG9yTWF0cml4IHZhbHVlcz0iMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMC4yNzc0NT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RPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI0IDAiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIi8+PC9maWx0ZXI+PGNpcmNsZSBpZD0icHJlZml4X19iIiBjeD0iMTU3IiBjeT0iMzUyIiByPSIxMCIvPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQzIC0zMzgpIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTU3IiBjeT0iMzUyIiByPSI4LjgiLz48L2c+PC9zdmc+";
3571
3588
  const PassengerCircle_css_ts_vanilla = "";
@@ -3899,7 +3916,6 @@ const useFirstWorkflowRecomendLoading = () => {
3899
3916
  };
3900
3917
  const RECOMMEND_PLACE_DRAG_LIMIT = 10;
3901
3918
  const RECOMMEND_PLACE_LARGE_LIMIT = 100;
3902
- const MAP_DRAG_END_WAIT_ANIMATION = 500;
3903
3919
  const RECOMMEND_PLACE_ZOOM_MIN = 13;
3904
3920
  const DEFAULT_PLACE_NAME = "当前位置";
3905
3921
  const DEFAULT_ZOOM = 8;
@@ -3931,12 +3947,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
3931
3947
  mapRef,
3932
3948
  defaultValue: DEFAULT_ZOOM
3933
3949
  });
3934
- const {
3935
- timerStart,
3936
- timerStop
3937
- } = useWaitTimer({
3938
- interval: MAP_DRAG_END_WAIT_ANIMATION
3939
- });
3940
3950
  const {
3941
3951
  isFirstWorkflowRecomendLoadingRef,
3942
3952
  completeFirstWorkflowRecomend
@@ -4015,7 +4025,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
4015
4025
  mapRef,
4016
4026
  onChange: (point) => {
4017
4027
  centerSource.source = "drag";
4018
- timerStart();
4019
4028
  updatePlace(point);
4020
4029
  emit("changeByDrag", point);
4021
4030
  }
@@ -4053,7 +4062,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
4053
4062
  emit("changePlace", place);
4054
4063
  },
4055
4064
  onChange: async (place) => {
4056
- await timerStop.promise;
4057
4065
  centerSource.source = "recomend";
4058
4066
  Object.assign(centerPlace, {
4059
4067
  ...place
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",
package/todo.md CHANGED
@@ -101,3 +101,8 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
101
101
  0.5.6
102
102
 
103
103
  - 5455
104
+
105
+ 0.5.9
106
+
107
+ - 5500
108
+ - 5524