@heycar/heycars-map 0.6.3 → 0.6.5

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,2 +1,10 @@
1
1
  export declare const gmap: string;
2
+ export declare const noneTouchAction: import("@vanilla-extract/recipes").RuntimeFn<{
3
+ enable: {
4
+ true: {
5
+ touchAction: "none";
6
+ };
7
+ false: {};
8
+ };
9
+ }>;
2
10
  export declare const gmapLayout: string;
@@ -4,9 +4,10 @@ import { UseResizeObserverProps } from "../../hooks/useResizeObserver";
4
4
  import type { MapEventHandler } from "../../types/mapHelper";
5
5
  export interface GmapProps extends google.maps.MapOptions {
6
6
  mapRef?: SetMap<google.maps.Map>;
7
+ touchZoomCenter?: boolean;
7
8
  onDragStart?: MapEventHandler<google.maps.Map>;
8
9
  onDragEnd?: MapEventHandler<google.maps.Map>;
9
- onZoom_change?: MapEventHandler<google.maps.Map>;
10
+ onZoom_changed?: MapEventHandler<google.maps.Map>;
10
11
  onResize?: UseResizeObserverProps["onChange"];
11
12
  }
12
- export declare const Gmap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<GmapProps>, 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<GmapProps, Required<GmapProps>>, "resize" | "dragStart" | "dragEnd" | "zoom_change", GmapProps, {}>;
13
+ export declare const Gmap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<GmapProps>, 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<GmapProps, Required<GmapProps>>, "resize" | "dragStart" | "dragEnd" | "zoom_changed", GmapProps, {}>;
@@ -0,0 +1,9 @@
1
+ /// <reference types="google.maps" />
2
+ import { Ref, ShallowRef } from "vue-demi";
3
+ interface UseMapGestureZoomCenterProps {
4
+ elementRef: ShallowRef<HTMLDivElement | undefined>;
5
+ mapRef: ShallowRef<google.maps.Map | undefined>;
6
+ enableRef: Ref<boolean>;
7
+ }
8
+ export declare const useGmapGestureZoomCenter: (props: UseMapGestureZoomCenterProps) => void;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="google.maps" />
2
+ import { ShallowRef } from "vue-demi";
3
+ interface UseGmapTouchStartCenterProps {
4
+ mapRef: ShallowRef<google.maps.Map | undefined>;
5
+ elementRef: ShallowRef<HTMLDivElement | undefined>;
6
+ }
7
+ export declare const useGmapTouchStartCenter: (props: UseGmapTouchStartCenterProps) => {
8
+ touchstartCenterRef: import("vue-demi").Ref<[number, number] | undefined>;
9
+ };
10
+ export {};
@@ -5,4 +5,5 @@ interface UseWheelZoomCenterProps<M = AMap.Map | google.maps.Map> {
5
5
  enableRef?: Ref<boolean>;
6
6
  }
7
7
  export declare const useAmapWheelZoomCenter: (props: UseWheelZoomCenterProps<AMap.Map>) => void;
8
+ export declare const useGmapWheelZoomCenter: (props: UseWheelZoomCenterProps<google.maps.Map>) => void;
8
9
  export {};
@@ -1,6 +1,6 @@
1
1
  import { ShallowRef } from "vue-demi";
2
2
  export interface UseResizeObserverProps {
3
- elementRef: ShallowRef<HTMLDivElement>;
3
+ elementRef: ShallowRef<HTMLDivElement | undefined>;
4
4
  onChange?: (props: {
5
5
  width: number;
6
6
  height: number;
package/dist/index.cjs CHANGED
@@ -884,8 +884,8 @@ createComparator(function() {
884
884
  createComparator(createCircularEqualCreator());
885
885
  createComparator(createCircularEqualCreator(sameValueZeroEqual));
886
886
  const vec2lnglat = ([lng, lat]) => ({
887
- lng,
888
- lat
887
+ lng: Number(lng),
888
+ lat: Number(lat)
889
889
  });
890
890
  const decodeAsterisk = (encodedValue) => {
891
891
  const result = [];
@@ -912,7 +912,7 @@ const language2vectorMapForeign = (lang) => {
912
912
  return "style_zh_cn";
913
913
  }
914
914
  };
915
- const place2point = (place) => [place.lng, place.lat];
915
+ const place2point = (place) => [Number(place.lng), Number(place.lat)];
916
916
  const pipeAsync = (fn) => (...args) => {
917
917
  Promise.resolve().then(() => fn == null ? void 0 : fn(...args));
918
918
  };
@@ -943,6 +943,15 @@ const isPlaceEqual = (p1, p2) => {
943
943
  const isPointEqual = (p1, p2) => {
944
944
  return p1[0] === (p2 == null ? void 0 : p2[0]) && p1[1] === (p2 == null ? void 0 : p2[1]);
945
945
  };
946
+ const toPlaceType = (maybePlace) => {
947
+ const lng = Number(maybePlace.lng);
948
+ if (isNaN(lng))
949
+ throw new Error("MyError: expect lng to be number");
950
+ const lat = Number(maybePlace.lat);
951
+ if (isNaN(lat))
952
+ throw new Error("MyError: expect lat to be number");
953
+ return { lng, lat, name: maybePlace.name };
954
+ };
946
955
  const deepCompareEqualsForMaps = createComparator((deepEqual) => (a, b) => {
947
956
  if (isLatLngLiteral(a) || isLatLngLiteral(b)) {
948
957
  return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));
@@ -1043,7 +1052,7 @@ function watchPostEffectForGMapEvent(targetRef, props, emit, propertyNames) {
1043
1052
  for (const name of propertyNames) {
1044
1053
  const emitEventName = property2emitEventName(name);
1045
1054
  const eventName = property2mapEventName(name);
1046
- const handler = (e) => emit(emitEventName, e);
1055
+ const handler = (e) => emit(emitEventName, { ...e, target });
1047
1056
  const listener = target.addListener(eventName, handler);
1048
1057
  cleanList.push(() => google.maps.event.removeListener(listener));
1049
1058
  }
@@ -1977,6 +1986,25 @@ const useMapEventSource = () => {
1977
1986
  };
1978
1987
  return { executeMapApi };
1979
1988
  };
1989
+ const useGmapTouchStartCenter = (props) => {
1990
+ const { mapRef, elementRef } = props;
1991
+ const touchstartCenterRef = Vue.ref(void 0);
1992
+ Vue.watchEffect((onCleanup) => {
1993
+ const map = mapRef.value;
1994
+ const element = elementRef.value;
1995
+ if (!map || !element)
1996
+ return;
1997
+ const handleTouchStart = () => {
1998
+ const center = map.getCenter();
1999
+ const lng = center == null ? void 0 : center.lng();
2000
+ const lat = center == null ? void 0 : center.lat();
2001
+ touchstartCenterRef.value = lng && lat ? [lng, lat] : void 0;
2002
+ };
2003
+ element.addEventListener("touchstart", handleTouchStart);
2004
+ onCleanup(() => element.removeEventListener("touchstart", handleTouchStart));
2005
+ });
2006
+ return { touchstartCenterRef };
2007
+ };
1980
2008
  const useResizeObserver = (props) => {
1981
2009
  const { elementRef, onChange } = props;
1982
2010
  const resizeObserver = new ResizeObserver(([entry]) => {
@@ -1997,27 +2025,109 @@ const useResizeObserver = (props) => {
1997
2025
  });
1998
2026
  };
1999
2027
  const Gmap_css_ts_vanilla = "";
2028
+ function _defineProperty(obj, key, value) {
2029
+ if (key in obj) {
2030
+ Object.defineProperty(obj, key, {
2031
+ value,
2032
+ enumerable: true,
2033
+ configurable: true,
2034
+ writable: true
2035
+ });
2036
+ } else {
2037
+ obj[key] = value;
2038
+ }
2039
+ return obj;
2040
+ }
2041
+ function ownKeys(object, enumerableOnly) {
2042
+ var keys2 = Object.keys(object);
2043
+ if (Object.getOwnPropertySymbols) {
2044
+ var symbols = Object.getOwnPropertySymbols(object);
2045
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
2046
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2047
+ })), keys2.push.apply(keys2, symbols);
2048
+ }
2049
+ return keys2;
2050
+ }
2051
+ function _objectSpread2(target) {
2052
+ for (var i = 1; i < arguments.length; i++) {
2053
+ var source = null != arguments[i] ? arguments[i] : {};
2054
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
2055
+ _defineProperty(target, key, source[key]);
2056
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
2057
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2058
+ });
2059
+ }
2060
+ return target;
2061
+ }
2062
+ var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
2063
+ for (var key of Object.keys(compoundCheck)) {
2064
+ var _selections$key;
2065
+ if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
2066
+ return false;
2067
+ }
2068
+ }
2069
+ return true;
2070
+ };
2071
+ var createRuntimeFn = (config) => (options) => {
2072
+ var className = config.defaultClassName;
2073
+ var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
2074
+ for (var variantName in selections) {
2075
+ var _selections$variantNa;
2076
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
2077
+ if (variantSelection != null) {
2078
+ var selection = variantSelection;
2079
+ if (typeof selection === "boolean") {
2080
+ selection = selection === true ? "true" : "false";
2081
+ }
2082
+ var selectionClassName = (
2083
+ // @ts-expect-error
2084
+ config.variantClassNames[variantName][selection]
2085
+ );
2086
+ if (selectionClassName) {
2087
+ className += " " + selectionClassName;
2088
+ }
2089
+ }
2090
+ }
2091
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
2092
+ if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
2093
+ className += " " + compoundClassName;
2094
+ }
2095
+ }
2096
+ return className;
2097
+ };
2000
2098
  var gmap = "_7anfuo0";
2099
+ createRuntimeFn({ defaultClassName: "", variantClassNames: { enable: { true: "_7anfuo1", false: "_7anfuo2" } }, defaultVariants: {}, compoundVariants: [] });
2001
2100
  const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
2002
2101
  const setMap = props.mapRef;
2003
2102
  const { onResize } = props;
2004
2103
  const options = Vue.computed(() => {
2005
- const { mapRef: mapRef2, onDragStart, onDragEnd, onZoom_change, ...options2 } = props;
2104
+ const { mapRef: mapRef2, onDragStart, onDragEnd, onZoom_changed, touchZoomCenter, ...options2 } = props;
2006
2105
  return options2;
2007
2106
  });
2008
2107
  const defaultOptions = options.value;
2009
2108
  const elementRef = Vue.shallowRef();
2010
2109
  const mapRef = Vue.shallowRef();
2011
2110
  const { executeMapApi } = useMapEventSource();
2012
- const handleDrag = (name) => emit(name, { target: mapRef.value });
2111
+ const { touchstartCenterRef } = useGmapTouchStartCenter({ mapRef, elementRef });
2112
+ const handleDrag = (name) => {
2113
+ emit(name, { target: mapRef.value });
2114
+ };
2115
+ const handleZoom = (name) => {
2116
+ var _a;
2117
+ emit(name, { target: mapRef.value });
2118
+ const center = touchstartCenterRef.value;
2119
+ if (center)
2120
+ (_a = mapRef.value) == null ? void 0 : _a.setCenter(vec2lnglat(center));
2121
+ };
2013
2122
  provideGmap(mapRef);
2014
2123
  useResizeObserver({ elementRef, onChange: onResize });
2015
2124
  Vue.watchPostEffect(() => {
2016
- if (mapRef.value || !elementRef.value)
2125
+ const element = elementRef.value;
2126
+ if (mapRef.value || !element)
2017
2127
  return;
2018
2128
  let map;
2019
2129
  executeMapApi(() => {
2020
- map = new google.maps.Map(elementRef.value, { ...defaultOptions });
2130
+ map = new google.maps.Map(element, { ...defaultOptions });
2021
2131
  window.GlobalGmap = map;
2022
2132
  });
2023
2133
  mapRef.value = map;
@@ -2032,11 +2142,8 @@ const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
2032
2142
  });
2033
2143
  }
2034
2144
  );
2035
- watchPostEffectForGMapEvent(mapRef, props, handleDrag, [
2036
- "onDragStart",
2037
- "onDragEnd",
2038
- "onZoom_change"
2039
- ]);
2145
+ watchPostEffectForGMapEvent(mapRef, props, handleDrag, ["onDragStart", "onDragEnd"]);
2146
+ watchPostEffectForGMapEvent(mapRef, props, handleZoom, ["onZoom_changed"]);
2040
2147
  return () => {
2041
2148
  var _a;
2042
2149
  return Vue.h("div", { ref: elementRef, class: gmap }, (_a = slots.default) == null ? void 0 : _a.call(slots));
@@ -2120,8 +2227,9 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2120
2227
  "disableDefaultUI": true,
2121
2228
  "clickableIcons": false,
2122
2229
  "disableDoubleClickZoom": touchEnable,
2123
- "gestureHandling": touchEnable ? "auto" : "none",
2124
- "keyboardShortcuts": touchEnable
2230
+ "gestureHandling": touchEnable ? "greedy" : "none",
2231
+ "keyboardShortcuts": touchEnable,
2232
+ "touchZoomCenter": touchZoomCenter
2125
2233
  },
2126
2234
  "on": {
2127
2235
  "dragEnd": gmapHandleDargEnd,
@@ -2540,7 +2648,7 @@ const spaceLog = (logKey, ...args) => {
2540
2648
  return;
2541
2649
  console.log(logKey, ...args);
2542
2650
  };
2543
- const GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT = 20;
2651
+ const GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT$1 = 20;
2544
2652
  const useAmapFitView = (props) => {
2545
2653
  const { mapRef, autoFitTimeout } = props;
2546
2654
  const overlayGroup = /* @__PURE__ */ new Set();
@@ -2662,7 +2770,7 @@ const useGmapFitView = (props) => {
2662
2770
  setFitView();
2663
2771
  }, autoFitTimeout);
2664
2772
  };
2665
- const handleZoomChange = debounce(handleMoveEnd, GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT);
2773
+ const handleZoomChange = debounce(handleMoveEnd, GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT$1);
2666
2774
  watchPostEffectForGMapEvent(mapRef, {}, handleMoveEnd, [
2667
2775
  "onDragEnd"
2668
2776
  ]);
@@ -2760,76 +2868,6 @@ const ZINDEX_PASSENGER_LAYER = 20;
2760
2868
  const imgEndPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI3Mi4zMzklIiB5MT0iNTAlIiB4Mj0iMCUiIHkyPSI1MCUiIGlkPSJwcmVmaXhfX2EiPjxzdG9wIHN0b3AtY29sb3I9IiNGRjg0NDciIG9mZnNldD0iMCUiLz48c3RvcCBzdG9w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SIjRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSI+PHRzcGFuIHg9IjUiIHk9IjE1LjYyNCI+6LW3PC90c3Bhbj48L3RleHQ+PC9nPjwvc3ZnPg==";
2762
2870
  const StartEndPoint_css_ts_vanilla = "";
2763
- function _defineProperty(obj, key, value) {
2764
- if (key in obj) {
2765
- Object.defineProperty(obj, key, {
2766
- value,
2767
- enumerable: true,
2768
- configurable: true,
2769
- writable: true
2770
- });
2771
- } else {
2772
- obj[key] = value;
2773
- }
2774
- return obj;
2775
- }
2776
- function ownKeys(object, enumerableOnly) {
2777
- var keys2 = Object.keys(object);
2778
- if (Object.getOwnPropertySymbols) {
2779
- var symbols = Object.getOwnPropertySymbols(object);
2780
- enumerableOnly && (symbols = symbols.filter(function(sym) {
2781
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2782
- })), keys2.push.apply(keys2, symbols);
2783
- }
2784
- return keys2;
2785
- }
2786
- function _objectSpread2(target) {
2787
- for (var i = 1; i < arguments.length; i++) {
2788
- var source = null != arguments[i] ? arguments[i] : {};
2789
- i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
2790
- _defineProperty(target, key, source[key]);
2791
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
2792
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2793
- });
2794
- }
2795
- return target;
2796
- }
2797
- var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
2798
- for (var key of Object.keys(compoundCheck)) {
2799
- var _selections$key;
2800
- if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
2801
- return false;
2802
- }
2803
- }
2804
- return true;
2805
- };
2806
- var createRuntimeFn = (config) => (options) => {
2807
- var className = config.defaultClassName;
2808
- var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
2809
- for (var variantName in selections) {
2810
- var _selections$variantNa;
2811
- var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
2812
- if (variantSelection != null) {
2813
- var selection = variantSelection;
2814
- if (typeof selection === "boolean") {
2815
- selection = selection === true ? "true" : "false";
2816
- }
2817
- var selectionClassName = (
2818
- // @ts-expect-error
2819
- config.variantClassNames[variantName][selection]
2820
- );
2821
- if (selectionClassName) {
2822
- className += " " + selectionClassName;
2823
- }
2824
- }
2825
- }
2826
- for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
2827
- if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
2828
- className += " " + compoundClassName;
2829
- }
2830
- }
2831
- return className;
2832
- };
2833
2871
  var pointIcon = createRuntimeFn({ defaultClassName: "", variantClassNames: { type: { start: "_4a4ovk6", end: "_4a4ovk7" } }, defaultVariants: {}, compoundVariants: [] });
2834
2872
  var pointInfoBox = "_4a4ovk1";
2835
2873
  var pointInfoBoxDescription = "_4a4ovk4";
@@ -3110,6 +3148,7 @@ const useGeoLocation = (props) => {
3110
3148
  loading.value = true;
3111
3149
  const watchId = singleGeoWatch.watchPosition(
3112
3150
  async (position) => {
3151
+ console.log("watchPosition success position = ", position);
3113
3152
  const coordinate = position.coords;
3114
3153
  const wgsPoint = [position.coords.longitude, position.coords.latitude];
3115
3154
  const point = await toGcj02(wgsPoint);
@@ -3123,6 +3162,7 @@ const useGeoLocation = (props) => {
3123
3162
  onChange == null ? void 0 : onChange({ position: point, coordinate });
3124
3163
  },
3125
3164
  (error) => {
3165
+ console.log("watchPosition error = ", error);
3126
3166
  loading.value = false;
3127
3167
  errorRef.value = error;
3128
3168
  const position = props == null ? void 0 : props.geoDefaultPosition;
@@ -3489,6 +3529,7 @@ const useMapRecomendPlace = (props) => {
3489
3529
  const { supplier } = useMapSupplier();
3490
3530
  return supplier === "gmap" ? useGmapRecomendPlace(props) : useAmapRecomendPlace(props);
3491
3531
  };
3532
+ const GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT = 50;
3492
3533
  const DEFAULT_ZOOM$1 = 13;
3493
3534
  const useAmapZoom = (props) => {
3494
3535
  var _a, _b, _c;
@@ -3518,13 +3559,16 @@ const useGmapZoom = (props) => {
3518
3559
  zoomRef.value = v;
3519
3560
  (_a2 = mapRef.value) == null ? void 0 : _a2.setZoom(v);
3520
3561
  };
3521
- const handleZoomChange = (_, { target }) => {
3522
- const zoom = target.getZoom();
3523
- zoomRef.value = zoom;
3524
- onChange == null ? void 0 : onChange(zoom);
3525
- };
3562
+ const handleZoomChange = debounce(
3563
+ (_, { target }) => {
3564
+ const zoom = target.getZoom();
3565
+ zoomRef.value = zoom;
3566
+ onChange == null ? void 0 : onChange(zoom);
3567
+ },
3568
+ GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT
3569
+ );
3526
3570
  watchPostEffectForGMapEvent(mapRef, {}, handleZoomChange, [
3527
- "onZoom_change"
3571
+ "onZoom_changed"
3528
3572
  ]);
3529
3573
  return { zoomRef, setZoom };
3530
3574
  };
@@ -3913,8 +3957,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
3913
3957
  centerSource.source = "api";
3914
3958
  updatePlace(point);
3915
3959
  };
3916
- const setCenterPlaceByUserSpecified = async (place) => {
3960
+ const setCenterPlaceByUserSpecified = async (input) => {
3917
3961
  centerSource.source = "api";
3962
+ const place = toPlaceType(input);
3918
3963
  centerPlace.lng = place.lng;
3919
3964
  centerPlace.lat = place.lat;
3920
3965
  centerPlace.name = place.name;
@@ -3940,12 +3985,14 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
3940
3985
  } = useGeoLocation({
3941
3986
  geoDefaultPosition,
3942
3987
  onLoad: async (value) => {
3988
+ console.log("useGeoLocation onLoad value = ", value);
3943
3989
  await readyPromise;
3944
3990
  centerSource.source = "geo";
3945
3991
  updatePlace(value.position);
3946
3992
  emit("loadGeoLocation", value);
3947
3993
  },
3948
3994
  onLoadDefault: async (value) => {
3995
+ console.log("useGeoLocation onLoadDefault value = ", value);
3949
3996
  await readyPromise;
3950
3997
  const place = await defaultCenterPlacePromise;
3951
3998
  centerSource.source = "geo";
@@ -4039,6 +4086,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
4039
4086
  } = props;
4040
4087
  const title = geoLoading.value ? geoLoadingTitle : !availableRef.value ? unavailableTitle : centerPlace.name;
4041
4088
  const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
4089
+ console.log("BusinessRecomendPlaceMap render geoLoading, isFirstWorkflowRecomendLoadingRef = ", geoLoading.value, isFirstWorkflowRecomendLoadingRef.value);
4042
4090
  return Vue.h(HeycarMap, {
4043
4091
  "attrs": {
4044
4092
  "center": centerPoint.value,
@@ -4973,10 +5021,12 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
4973
5021
  const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
4974
5022
  return () => {
4975
5023
  const {
4976
- from,
4977
- to
5024
+ from: inputFrom,
5025
+ to: inputTo
4978
5026
  } = props;
4979
- const isReady = isPlace(from) && isPlace(to);
5027
+ const isReady = isPlace(inputFrom) && isPlace(inputTo);
5028
+ const from = toPlaceType(inputFrom);
5029
+ const to = toPlaceType(inputTo);
4980
5030
  const center = isReady ? place2point(from) : [...BEIJIN_POINT];
4981
5031
  return Vue.h(HeycarMap, {
4982
5032
  "attrs": {
@@ -5040,12 +5090,14 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
5040
5090
  return () => {
5041
5091
  const {
5042
5092
  driverStatus,
5043
- from,
5044
- to,
5093
+ from: inputFrom,
5094
+ to: inputTo,
5045
5095
  dispatchingTitle,
5046
5096
  bookDispatchingTitle,
5047
5097
  driverArrivedTitle
5048
5098
  } = props;
5099
+ const from = toPlaceType(inputFrom);
5100
+ const to = toPlaceType(inputTo);
5049
5101
  const carPosition = carPositionRef.value;
5050
5102
  const carAngle = carAngleRef.value;
5051
5103
  const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, reactive, toRefs, ref, toRef, watchEffect } from "vue";
7
+ import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, ref, watchEffect, reactive, toRefs, toRef } from "vue";
8
8
  const style = "";
9
9
  Vue.util.warn;
10
10
  const imgAddressLocator = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSItMzkuNzE5JSIgeTE9IjUwJSIgeDI9IjEyNi4wOTMlIiB5Mj0iNTAlIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjNzlBRkZGIiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzVDOERGRiIgb2Zmc2V0PSIzMi4zNDIlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzUwN0ZGRiIgb2Zmc2V0PSI3NC44NTMlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzQ0NzFGRiIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTEuNSAyNGgzdjE0LjVhMS41IDEuNSAwIDAxLTMgMFYyNHoiIGZpbGw9IiM0QzgwRkYiLz48Zz48Y2lyY2xlIGZpbGw9InVybCgjcHJlZml4X19hKSIgY3g9IjEzIiBjeT0iMTMiIHI9IjEzIi8+PGNpcmNsZSBmaWxsPSIjRkZGIiBjeD0iMTMiIGN5PSIxMyIgcj0iNCIvPjwvZz48L2c+PC9zdmc+";
@@ -882,8 +882,8 @@ createComparator(function() {
882
882
  createComparator(createCircularEqualCreator());
883
883
  createComparator(createCircularEqualCreator(sameValueZeroEqual));
884
884
  const vec2lnglat = ([lng, lat]) => ({
885
- lng,
886
- lat
885
+ lng: Number(lng),
886
+ lat: Number(lat)
887
887
  });
888
888
  const decodeAsterisk = (encodedValue) => {
889
889
  const result = [];
@@ -910,7 +910,7 @@ const language2vectorMapForeign = (lang) => {
910
910
  return "style_zh_cn";
911
911
  }
912
912
  };
913
- const place2point = (place) => [place.lng, place.lat];
913
+ const place2point = (place) => [Number(place.lng), Number(place.lat)];
914
914
  const pipeAsync = (fn) => (...args) => {
915
915
  Promise.resolve().then(() => fn == null ? void 0 : fn(...args));
916
916
  };
@@ -941,6 +941,15 @@ const isPlaceEqual = (p1, p2) => {
941
941
  const isPointEqual = (p1, p2) => {
942
942
  return p1[0] === (p2 == null ? void 0 : p2[0]) && p1[1] === (p2 == null ? void 0 : p2[1]);
943
943
  };
944
+ const toPlaceType = (maybePlace) => {
945
+ const lng = Number(maybePlace.lng);
946
+ if (isNaN(lng))
947
+ throw new Error("MyError: expect lng to be number");
948
+ const lat = Number(maybePlace.lat);
949
+ if (isNaN(lat))
950
+ throw new Error("MyError: expect lat to be number");
951
+ return { lng, lat, name: maybePlace.name };
952
+ };
944
953
  const deepCompareEqualsForMaps = createComparator((deepEqual) => (a, b) => {
945
954
  if (isLatLngLiteral(a) || isLatLngLiteral(b)) {
946
955
  return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));
@@ -1041,7 +1050,7 @@ function watchPostEffectForGMapEvent(targetRef, props, emit, propertyNames) {
1041
1050
  for (const name of propertyNames) {
1042
1051
  const emitEventName = property2emitEventName(name);
1043
1052
  const eventName = property2mapEventName(name);
1044
- const handler = (e) => emit(emitEventName, e);
1053
+ const handler = (e) => emit(emitEventName, { ...e, target });
1045
1054
  const listener = target.addListener(eventName, handler);
1046
1055
  cleanList.push(() => google.maps.event.removeListener(listener));
1047
1056
  }
@@ -1975,6 +1984,25 @@ const useMapEventSource = () => {
1975
1984
  };
1976
1985
  return { executeMapApi };
1977
1986
  };
1987
+ const useGmapTouchStartCenter = (props) => {
1988
+ const { mapRef, elementRef } = props;
1989
+ const touchstartCenterRef = ref(void 0);
1990
+ watchEffect((onCleanup) => {
1991
+ const map = mapRef.value;
1992
+ const element = elementRef.value;
1993
+ if (!map || !element)
1994
+ return;
1995
+ const handleTouchStart = () => {
1996
+ const center = map.getCenter();
1997
+ const lng = center == null ? void 0 : center.lng();
1998
+ const lat = center == null ? void 0 : center.lat();
1999
+ touchstartCenterRef.value = lng && lat ? [lng, lat] : void 0;
2000
+ };
2001
+ element.addEventListener("touchstart", handleTouchStart);
2002
+ onCleanup(() => element.removeEventListener("touchstart", handleTouchStart));
2003
+ });
2004
+ return { touchstartCenterRef };
2005
+ };
1978
2006
  const useResizeObserver = (props) => {
1979
2007
  const { elementRef, onChange } = props;
1980
2008
  const resizeObserver = new ResizeObserver(([entry]) => {
@@ -1995,27 +2023,109 @@ const useResizeObserver = (props) => {
1995
2023
  });
1996
2024
  };
1997
2025
  const Gmap_css_ts_vanilla = "";
2026
+ function _defineProperty(obj, key, value) {
2027
+ if (key in obj) {
2028
+ Object.defineProperty(obj, key, {
2029
+ value,
2030
+ enumerable: true,
2031
+ configurable: true,
2032
+ writable: true
2033
+ });
2034
+ } else {
2035
+ obj[key] = value;
2036
+ }
2037
+ return obj;
2038
+ }
2039
+ function ownKeys(object, enumerableOnly) {
2040
+ var keys2 = Object.keys(object);
2041
+ if (Object.getOwnPropertySymbols) {
2042
+ var symbols = Object.getOwnPropertySymbols(object);
2043
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
2044
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2045
+ })), keys2.push.apply(keys2, symbols);
2046
+ }
2047
+ return keys2;
2048
+ }
2049
+ function _objectSpread2(target) {
2050
+ for (var i = 1; i < arguments.length; i++) {
2051
+ var source = null != arguments[i] ? arguments[i] : {};
2052
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
2053
+ _defineProperty(target, key, source[key]);
2054
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
2055
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2056
+ });
2057
+ }
2058
+ return target;
2059
+ }
2060
+ var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
2061
+ for (var key of Object.keys(compoundCheck)) {
2062
+ var _selections$key;
2063
+ if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
2064
+ return false;
2065
+ }
2066
+ }
2067
+ return true;
2068
+ };
2069
+ var createRuntimeFn = (config) => (options) => {
2070
+ var className = config.defaultClassName;
2071
+ var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
2072
+ for (var variantName in selections) {
2073
+ var _selections$variantNa;
2074
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
2075
+ if (variantSelection != null) {
2076
+ var selection = variantSelection;
2077
+ if (typeof selection === "boolean") {
2078
+ selection = selection === true ? "true" : "false";
2079
+ }
2080
+ var selectionClassName = (
2081
+ // @ts-expect-error
2082
+ config.variantClassNames[variantName][selection]
2083
+ );
2084
+ if (selectionClassName) {
2085
+ className += " " + selectionClassName;
2086
+ }
2087
+ }
2088
+ }
2089
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
2090
+ if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
2091
+ className += " " + compoundClassName;
2092
+ }
2093
+ }
2094
+ return className;
2095
+ };
1998
2096
  var gmap = "_7anfuo0";
2097
+ createRuntimeFn({ defaultClassName: "", variantClassNames: { enable: { true: "_7anfuo1", false: "_7anfuo2" } }, defaultVariants: {}, compoundVariants: [] });
1999
2098
  const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
2000
2099
  const setMap = props.mapRef;
2001
2100
  const { onResize } = props;
2002
2101
  const options = computed(() => {
2003
- const { mapRef: mapRef2, onDragStart, onDragEnd, onZoom_change, ...options2 } = props;
2102
+ const { mapRef: mapRef2, onDragStart, onDragEnd, onZoom_changed, touchZoomCenter, ...options2 } = props;
2004
2103
  return options2;
2005
2104
  });
2006
2105
  const defaultOptions = options.value;
2007
2106
  const elementRef = shallowRef();
2008
2107
  const mapRef = shallowRef();
2009
2108
  const { executeMapApi } = useMapEventSource();
2010
- const handleDrag = (name) => emit(name, { target: mapRef.value });
2109
+ const { touchstartCenterRef } = useGmapTouchStartCenter({ mapRef, elementRef });
2110
+ const handleDrag = (name) => {
2111
+ emit(name, { target: mapRef.value });
2112
+ };
2113
+ const handleZoom = (name) => {
2114
+ var _a;
2115
+ emit(name, { target: mapRef.value });
2116
+ const center = touchstartCenterRef.value;
2117
+ if (center)
2118
+ (_a = mapRef.value) == null ? void 0 : _a.setCenter(vec2lnglat(center));
2119
+ };
2011
2120
  provideGmap(mapRef);
2012
2121
  useResizeObserver({ elementRef, onChange: onResize });
2013
2122
  watchPostEffect(() => {
2014
- if (mapRef.value || !elementRef.value)
2123
+ const element = elementRef.value;
2124
+ if (mapRef.value || !element)
2015
2125
  return;
2016
2126
  let map;
2017
2127
  executeMapApi(() => {
2018
- map = new google.maps.Map(elementRef.value, { ...defaultOptions });
2128
+ map = new google.maps.Map(element, { ...defaultOptions });
2019
2129
  window.GlobalGmap = map;
2020
2130
  });
2021
2131
  mapRef.value = map;
@@ -2030,11 +2140,8 @@ const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
2030
2140
  });
2031
2141
  }
2032
2142
  );
2033
- watchPostEffectForGMapEvent(mapRef, props, handleDrag, [
2034
- "onDragStart",
2035
- "onDragEnd",
2036
- "onZoom_change"
2037
- ]);
2143
+ watchPostEffectForGMapEvent(mapRef, props, handleDrag, ["onDragStart", "onDragEnd"]);
2144
+ watchPostEffectForGMapEvent(mapRef, props, handleZoom, ["onZoom_changed"]);
2038
2145
  return () => {
2039
2146
  var _a;
2040
2147
  return h("div", { ref: elementRef, class: gmap }, (_a = slots.default) == null ? void 0 : _a.call(slots));
@@ -2118,8 +2225,9 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
2118
2225
  "disableDefaultUI": true,
2119
2226
  "clickableIcons": false,
2120
2227
  "disableDoubleClickZoom": touchEnable,
2121
- "gestureHandling": touchEnable ? "auto" : "none",
2122
- "keyboardShortcuts": touchEnable
2228
+ "gestureHandling": touchEnable ? "greedy" : "none",
2229
+ "keyboardShortcuts": touchEnable,
2230
+ "touchZoomCenter": touchZoomCenter
2123
2231
  },
2124
2232
  "on": {
2125
2233
  "dragEnd": gmapHandleDargEnd,
@@ -2538,7 +2646,7 @@ const spaceLog = (logKey, ...args) => {
2538
2646
  return;
2539
2647
  console.log(logKey, ...args);
2540
2648
  };
2541
- const GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT = 20;
2649
+ const GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT$1 = 20;
2542
2650
  const useAmapFitView = (props) => {
2543
2651
  const { mapRef, autoFitTimeout } = props;
2544
2652
  const overlayGroup = /* @__PURE__ */ new Set();
@@ -2660,7 +2768,7 @@ const useGmapFitView = (props) => {
2660
2768
  setFitView();
2661
2769
  }, autoFitTimeout);
2662
2770
  };
2663
- const handleZoomChange = debounce(handleMoveEnd, GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT);
2771
+ const handleZoomChange = debounce(handleMoveEnd, GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT$1);
2664
2772
  watchPostEffectForGMapEvent(mapRef, {}, handleMoveEnd, [
2665
2773
  "onDragEnd"
2666
2774
  ]);
@@ -2758,76 +2866,6 @@ const ZINDEX_PASSENGER_LAYER = 20;
2758
2866
  const imgEndPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI3Mi4zMzklIiB5MT0iNTAlIiB4Mj0iMCUiIHkyPSI1MCUiIGlkPSJwcmVmaXhfX2EiPjxzdG9wIHN0b3AtY29sb3I9IiNGRjg0NDciIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkY4QjRBIiBvZmZzZXQ9IjUwLjU5NiUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZBOTVBIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMiAzMC4yMTVjMi4xMzQgMCAzLjg2My0uODkzIDMuODYzLTEuOTk1IDAtMS4xLTEuNzMtMS45OTQtMy44NjMtMS45OTQtMi4xMzQgMC0zLjg2My44OTMtMy44NjMgMS45OTQgMCAxLjEwMiAxLjczIDEuOTk1IDMuODYzIDEuOTk1eiIgZmlsbC1vcGFjaXR5PSIuNSIgZmlsbD0iIzQzNDg1QSIvPjxwYXRoIGQ9Ik0xMSAyNy4wMDZjMi4xMjggMC0uOS0zLjc0MyA1LjYyMS02LjY0M0MxOS44NDIgMTguNDUzIDIyIDE0Ljk1MyAyMiAxMC45NSAyMiA0LjkwMiAxNy4wNzUgMCAxMSAwUzAgNC45MDIgMCAxMC45NWMwIDMuOTE4IDIuMDY4IDcuMzU2IDUuMTc3IDkuMjlDMTEuNzUgMjMuMjg0IDkuMDYgMjcuMDA3IDExIDI3L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xIDMuMjIxLTEuOTEgNS4zNzktNS40MSA1LjM3OS05LjQxMkMyMiA0LjkwMSAxNy4wNzUgMCAxMSAwUzAgNC45MDEgMCAxMC45NDdjMCAzLjkxOCAyLjA2OCA3LjM1NSA1LjE3NyA5LjI5QzExLjc1IDIzLjI3NyA5LjA2IDI3IDExIDI3eiIgc3Ryb2tlPSIjRkZGIiBmaWxsPSJ1cmwoI3ByZWZpeF9fYSkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMS4yMTUpIi8+PHRleHQgZm9udC1mYW1pbHk9IlBpbmdGYW5nU0MtU2VtaWJvbGQsIFBpbmdGYW5nIFNDIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0iNTAwIiBmaWxsPSIjRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSI+PHRzcGFuIHg9IjUiIHk9IjE1LjYyNCI+6LW3PC90c3Bhbj48L3RleHQ+PC9nPjwvc3ZnPg==";
2760
2868
  const StartEndPoint_css_ts_vanilla = "";
2761
- function _defineProperty(obj, key, value) {
2762
- if (key in obj) {
2763
- Object.defineProperty(obj, key, {
2764
- value,
2765
- enumerable: true,
2766
- configurable: true,
2767
- writable: true
2768
- });
2769
- } else {
2770
- obj[key] = value;
2771
- }
2772
- return obj;
2773
- }
2774
- function ownKeys(object, enumerableOnly) {
2775
- var keys2 = Object.keys(object);
2776
- if (Object.getOwnPropertySymbols) {
2777
- var symbols = Object.getOwnPropertySymbols(object);
2778
- enumerableOnly && (symbols = symbols.filter(function(sym) {
2779
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2780
- })), keys2.push.apply(keys2, symbols);
2781
- }
2782
- return keys2;
2783
- }
2784
- function _objectSpread2(target) {
2785
- for (var i = 1; i < arguments.length; i++) {
2786
- var source = null != arguments[i] ? arguments[i] : {};
2787
- i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
2788
- _defineProperty(target, key, source[key]);
2789
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
2790
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2791
- });
2792
- }
2793
- return target;
2794
- }
2795
- var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
2796
- for (var key of Object.keys(compoundCheck)) {
2797
- var _selections$key;
2798
- if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
2799
- return false;
2800
- }
2801
- }
2802
- return true;
2803
- };
2804
- var createRuntimeFn = (config) => (options) => {
2805
- var className = config.defaultClassName;
2806
- var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
2807
- for (var variantName in selections) {
2808
- var _selections$variantNa;
2809
- var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
2810
- if (variantSelection != null) {
2811
- var selection = variantSelection;
2812
- if (typeof selection === "boolean") {
2813
- selection = selection === true ? "true" : "false";
2814
- }
2815
- var selectionClassName = (
2816
- // @ts-expect-error
2817
- config.variantClassNames[variantName][selection]
2818
- );
2819
- if (selectionClassName) {
2820
- className += " " + selectionClassName;
2821
- }
2822
- }
2823
- }
2824
- for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
2825
- if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
2826
- className += " " + compoundClassName;
2827
- }
2828
- }
2829
- return className;
2830
- };
2831
2869
  var pointIcon = createRuntimeFn({ defaultClassName: "", variantClassNames: { type: { start: "_4a4ovk6", end: "_4a4ovk7" } }, defaultVariants: {}, compoundVariants: [] });
2832
2870
  var pointInfoBox = "_4a4ovk1";
2833
2871
  var pointInfoBoxDescription = "_4a4ovk4";
@@ -3108,6 +3146,7 @@ const useGeoLocation = (props) => {
3108
3146
  loading.value = true;
3109
3147
  const watchId = singleGeoWatch.watchPosition(
3110
3148
  async (position) => {
3149
+ console.log("watchPosition success position = ", position);
3111
3150
  const coordinate = position.coords;
3112
3151
  const wgsPoint = [position.coords.longitude, position.coords.latitude];
3113
3152
  const point = await toGcj02(wgsPoint);
@@ -3121,6 +3160,7 @@ const useGeoLocation = (props) => {
3121
3160
  onChange == null ? void 0 : onChange({ position: point, coordinate });
3122
3161
  },
3123
3162
  (error) => {
3163
+ console.log("watchPosition error = ", error);
3124
3164
  loading.value = false;
3125
3165
  errorRef.value = error;
3126
3166
  const position = props == null ? void 0 : props.geoDefaultPosition;
@@ -3487,6 +3527,7 @@ const useMapRecomendPlace = (props) => {
3487
3527
  const { supplier } = useMapSupplier();
3488
3528
  return supplier === "gmap" ? useGmapRecomendPlace(props) : useAmapRecomendPlace(props);
3489
3529
  };
3530
+ const GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT = 50;
3490
3531
  const DEFAULT_ZOOM$1 = 13;
3491
3532
  const useAmapZoom = (props) => {
3492
3533
  var _a, _b, _c;
@@ -3516,13 +3557,16 @@ const useGmapZoom = (props) => {
3516
3557
  zoomRef.value = v;
3517
3558
  (_a2 = mapRef.value) == null ? void 0 : _a2.setZoom(v);
3518
3559
  };
3519
- const handleZoomChange = (_, { target }) => {
3520
- const zoom = target.getZoom();
3521
- zoomRef.value = zoom;
3522
- onChange == null ? void 0 : onChange(zoom);
3523
- };
3560
+ const handleZoomChange = debounce(
3561
+ (_, { target }) => {
3562
+ const zoom = target.getZoom();
3563
+ zoomRef.value = zoom;
3564
+ onChange == null ? void 0 : onChange(zoom);
3565
+ },
3566
+ GOOGLE_MAP_ZOOM_CHANGE_DEBOUNCE_TIMEOUT
3567
+ );
3524
3568
  watchPostEffectForGMapEvent(mapRef, {}, handleZoomChange, [
3525
- "onZoom_change"
3569
+ "onZoom_changed"
3526
3570
  ]);
3527
3571
  return { zoomRef, setZoom };
3528
3572
  };
@@ -3911,8 +3955,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
3911
3955
  centerSource.source = "api";
3912
3956
  updatePlace(point);
3913
3957
  };
3914
- const setCenterPlaceByUserSpecified = async (place) => {
3958
+ const setCenterPlaceByUserSpecified = async (input) => {
3915
3959
  centerSource.source = "api";
3960
+ const place = toPlaceType(input);
3916
3961
  centerPlace.lng = place.lng;
3917
3962
  centerPlace.lat = place.lat;
3918
3963
  centerPlace.name = place.name;
@@ -3938,12 +3983,14 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
3938
3983
  } = useGeoLocation({
3939
3984
  geoDefaultPosition,
3940
3985
  onLoad: async (value) => {
3986
+ console.log("useGeoLocation onLoad value = ", value);
3941
3987
  await readyPromise;
3942
3988
  centerSource.source = "geo";
3943
3989
  updatePlace(value.position);
3944
3990
  emit("loadGeoLocation", value);
3945
3991
  },
3946
3992
  onLoadDefault: async (value) => {
3993
+ console.log("useGeoLocation onLoadDefault value = ", value);
3947
3994
  await readyPromise;
3948
3995
  const place = await defaultCenterPlacePromise;
3949
3996
  centerSource.source = "geo";
@@ -4037,6 +4084,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
4037
4084
  } = props;
4038
4085
  const title = geoLoading.value ? geoLoadingTitle : !availableRef.value ? unavailableTitle : centerPlace.name;
4039
4086
  const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
4087
+ console.log("BusinessRecomendPlaceMap render geoLoading, isFirstWorkflowRecomendLoadingRef = ", geoLoading.value, isFirstWorkflowRecomendLoadingRef.value);
4040
4088
  return h(HeycarMap, {
4041
4089
  "attrs": {
4042
4090
  "center": centerPoint.value,
@@ -4971,10 +5019,12 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
4971
5019
  const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
4972
5020
  return () => {
4973
5021
  const {
4974
- from,
4975
- to
5022
+ from: inputFrom,
5023
+ to: inputTo
4976
5024
  } = props;
4977
- const isReady = isPlace(from) && isPlace(to);
5025
+ const isReady = isPlace(inputFrom) && isPlace(inputTo);
5026
+ const from = toPlaceType(inputFrom);
5027
+ const to = toPlaceType(inputTo);
4978
5028
  const center = isReady ? place2point(from) : [...BEIJIN_POINT];
4979
5029
  return h(HeycarMap, {
4980
5030
  "attrs": {
@@ -5038,12 +5088,14 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
5038
5088
  return () => {
5039
5089
  const {
5040
5090
  driverStatus,
5041
- from,
5042
- to,
5091
+ from: inputFrom,
5092
+ to: inputTo,
5043
5093
  dispatchingTitle,
5044
5094
  bookDispatchingTitle,
5045
5095
  driverArrivedTitle
5046
5096
  } = props;
5097
+ const from = toPlaceType(inputFrom);
5098
+ const to = toPlaceType(inputTo);
5047
5099
  const carPosition = carPositionRef.value;
5048
5100
  const carAngle = carAngleRef.value;
5049
5101
  const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
package/dist/style.css CHANGED
@@ -116,6 +116,9 @@
116
116
  width: inherit;
117
117
  }
118
118
  ._7anfuo1 {
119
+ touch-action: none;
120
+ }
121
+ ._7anfuo3 {
119
122
  position: relative;
120
123
  }
121
124
  a[title*="Google"]>div>img[alt="Google"], .gmnoprint {
@@ -123,6 +126,10 @@ a[title*="Google"]>div>img[alt="Google"], .gmnoprint {
123
126
  }
124
127
  ._7anfuo0 [class*="marker-view"] {
125
128
  will-change: unset !important;
129
+ }
130
+ ._7anfuo0 a, ._7anfuo0 img, ._7anfuo0 div, ._7anfuo0 button {
131
+ -webkit-tap-highlight-color: transparent;
132
+ outline: none;
126
133
  }._4a4ovk0 {
127
134
  margin-bottom: -0.4vw;
128
135
  display: flex;
@@ -0,0 +1,12 @@
1
+ interface EaseAnimatieRenderProps {
2
+ value: number[];
3
+ delta: number[];
4
+ }
5
+ export interface EaseAnimatieProps {
6
+ from: number[];
7
+ to: number[];
8
+ duration: number;
9
+ render: (props: EaseAnimatieRenderProps) => void;
10
+ }
11
+ export declare const easeAnimate: (props: EaseAnimatieProps) => void;
12
+ export {};
@@ -16,3 +16,8 @@ export declare const pipeDefer: <P extends any[], R>(fn: (...args: P) => R) => (
16
16
  export declare const pipeOnlyLastEffect: <P extends any[], R>(fn: (...arg: P) => Promise<R>) => (...args: P) => Promise<R>;
17
17
  export declare const isPlaceEqual: (p1: Place, p2?: Place) => boolean;
18
18
  export declare const isPointEqual: (p1: Point, p2?: Point) => boolean;
19
+ export declare const toPlaceType: (maybePlace: {
20
+ name: string;
21
+ lng: string | number;
22
+ lat: string | number;
23
+ }) => Place;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",
@@ -26,6 +26,7 @@
26
26
  "@amap/amap-jsapi-types": "^0.0.13",
27
27
  "@googlemaps/js-api-loader": "^1.15.1",
28
28
  "@googlemaps/typescript-guards": "^2.0.3",
29
+ "@use-gesture/vanilla": "^10.2.26",
29
30
  "fast-equals": "^3.0.3",
30
31
  "lodash-es": "^4.17.21",
31
32
  "vue-demi": "^0.13.11"
package/todo.md CHANGED
@@ -5,6 +5,11 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
5
5
  4. map 的两个 slot loading 和 error slot 没有生效
6
6
  5. 企业微信如果关闭定位,会不停的跳 geoError 事件
7
7
 
8
+ 二期:
9
+
10
+ 1. 绿区数据格式约定
11
+ 2. map loading 设计稿
12
+
8
13
  缩放问题
9
14
 
10
15
  - 4867
@@ -115,3 +120,12 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
115
120
  - 5546
116
121
  - 5541
117
122
  - 5540
123
+
124
+ 0.6.5
125
+
126
+ - 5640
127
+ - 5631
128
+ - 5614
129
+ - 5598
130
+ - 5567
131
+ - 5560