@heycar/heycars-map 0.7.0 → 0.7.2

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.
@@ -8,14 +8,14 @@ type SectionDispatchingProps = Required<MROP> & {
8
8
  export declare const SectionDispatching: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<SectionDispatchingProps>, 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<SectionDispatchingProps, Required<SectionDispatchingProps>>, never, SectionDispatchingProps, {} | {}>;
9
9
  type SectionConfirmedProps = Required<MROP> & {
10
10
  passengerPosition?: Point;
11
- passengerAngle?: number;
11
+ passengerAngle?: string;
12
12
  from: Place;
13
13
  to: Place;
14
14
  };
15
15
  export declare const SectionConfirmed: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<SectionConfirmedProps>, 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<SectionConfirmedProps, Required<SectionConfirmedProps>>, never, SectionConfirmedProps, {} | {}>;
16
16
  type SectionDriverStartServiceProps = Required<MROP> & {
17
17
  passengerPosition?: Point;
18
- passengerAngle?: number;
18
+ passengerAngle?: string;
19
19
  carPosition?: Point;
20
20
  carAngle?: number;
21
21
  from: Place;
@@ -24,7 +24,7 @@ type SectionDriverStartServiceProps = Required<MROP> & {
24
24
  export declare const SectionDriverStartService: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<SectionDriverStartServiceProps>, 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<SectionDriverStartServiceProps, Required<SectionDriverStartServiceProps>>, never, SectionDriverStartServiceProps, {} | {}>;
25
25
  type SectionBookDispatchedProps = Required<MROP> & {
26
26
  passengerPosition?: Point;
27
- passengerAngle?: number;
27
+ passengerAngle?: string;
28
28
  from: Place;
29
29
  to: Place;
30
30
  };
@@ -34,7 +34,7 @@ type SectionDriverArrivedProps = Required<MROP> & {
34
34
  carPosition?: Point;
35
35
  carAngle?: number;
36
36
  passengerPosition?: Point;
37
- passengerAngle?: number;
37
+ passengerAngle?: string;
38
38
  title: string;
39
39
  };
40
40
  export declare const SectionDriverArrived: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<SectionDriverArrivedProps>, 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<SectionDriverArrivedProps, Required<SectionDriverArrivedProps>>, never, SectionDriverArrivedProps, {} | {}>;
@@ -1,14 +1,25 @@
1
1
  export declare const passengerCircle: import("@vanilla-extract/recipes").RuntimeFn<{
2
- size: {
2
+ type: {
3
3
  small: {
4
4
  width: "6.6vw";
5
5
  height: "6.6vw";
6
6
  marginBottom: "-3.3vw";
7
7
  };
8
+ smallArrow: {
9
+ width: "6.6vw";
10
+ height: "7.738vw";
11
+ marginBottom: "-3.3vw";
12
+ transformOrigin: "center 4.438vw";
13
+ };
8
14
  large: {
9
15
  width: "16.27vw";
10
16
  height: "16.27vw";
11
17
  marginBottom: "-8.135vw";
12
18
  };
19
+ largeArrow: {
20
+ width: "16.27vw";
21
+ height: "16.27vw";
22
+ marginBottom: "-8.135vw";
23
+ };
13
24
  };
14
25
  }>;
@@ -2,7 +2,7 @@ import type { GmapOverlay, MROP, MapRegisterOverlayProps } from "../../hooks/use
2
2
  import type { Point } from "../../types/interface";
3
3
  export interface PassengerCircleProps<T> extends MapRegisterOverlayProps<T> {
4
4
  position: [number, number];
5
- angle?: number;
5
+ angle?: string;
6
6
  size?: "small" | "large";
7
7
  }
8
8
  export declare const APassengerCircle: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<PassengerCircleProps<{
@@ -18315,6 +18315,6 @@ export declare const PassengerCircle: import("vue").DefineComponent<import("vue/
18315
18315
  export type ConditionalFittablePassengerCircleProps = MROP & {
18316
18316
  condition: boolean;
18317
18317
  position?: Point;
18318
- angle?: number;
18318
+ angle?: string;
18319
18319
  };
18320
18320
  export declare const ConditionalFittablePassengerCircle: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<ConditionalFittablePassengerCircleProps>, 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<ConditionalFittablePassengerCircleProps, Required<ConditionalFittablePassengerCircleProps>>, never, ConditionalFittablePassengerCircleProps, {} | {}>;
@@ -1,16 +1,20 @@
1
+ import { ShallowRef } from "vue-demi";
1
2
  interface Orientation {
2
3
  alpha?: number;
3
4
  beta?: number;
4
5
  gamma?: number;
6
+ cssRotationVariableName?: string;
5
7
  }
6
8
  export interface UseDeviceOrientationProps {
9
+ elementRef: ShallowRef<HTMLElement | undefined>;
7
10
  onChange?: (value: Orientation) => void;
8
11
  }
9
- export declare const useDeviceOrientation: (props?: UseDeviceOrientationProps) => {
12
+ export declare const useDeviceOrientation: (props: UseDeviceOrientationProps) => {
10
13
  orientation: {
11
14
  alpha?: number | undefined;
12
15
  beta?: number | undefined;
13
16
  gamma?: number | undefined;
17
+ cssRotationVariableName?: string | undefined;
14
18
  };
15
19
  };
16
20
  export {};
@@ -397,6 +397,7 @@ export declare const useHeycarAmap: () => {
397
397
  emit(type: AMap.EventType, data?: any): any;
398
398
  getEvents(): Record<string, any[]>;
399
399
  } | undefined>;
400
+ mapElementRef: import("vue-demi").ShallowRef<HTMLElement | undefined>;
400
401
  panTo: (value: [number, number]) => void | undefined;
401
402
  setMap: SetMap<{
402
403
  _outseaDataType: string;
@@ -797,6 +798,7 @@ export declare const useHeycarAmap: () => {
797
798
  };
798
799
  export declare const useHeycarGamp: () => {
799
800
  mapRef: import("vue-demi").ShallowRef<google.maps.Map | undefined>;
801
+ mapElementRef: import("vue-demi").ShallowRef<HTMLElement | undefined>;
800
802
  panTo: (value: [number, number]) => void | undefined;
801
803
  setMap: SetMap<google.maps.Map>;
802
804
  };
@@ -1197,6 +1199,7 @@ export declare const useHeycarMap: () => {
1197
1199
  emit(type: AMap.EventType, data?: any): any;
1198
1200
  getEvents(): Record<string, any[]>;
1199
1201
  } | undefined>;
1202
+ mapElementRef: import("vue-demi").ShallowRef<HTMLElement | undefined>;
1200
1203
  panTo: (value: [number, number]) => void | undefined;
1201
1204
  setMap: SetMap<{
1202
1205
  _outseaDataType: string;
@@ -1596,6 +1599,7 @@ export declare const useHeycarMap: () => {
1596
1599
  }>;
1597
1600
  } | {
1598
1601
  mapRef: import("vue-demi").ShallowRef<google.maps.Map | undefined>;
1602
+ mapElementRef: import("vue-demi").ShallowRef<HTMLElement | undefined>;
1599
1603
  panTo: (value: [number, number]) => void | undefined;
1600
1604
  setMap: SetMap<google.maps.Map>;
1601
1605
  };
package/dist/index.cjs CHANGED
@@ -947,6 +947,12 @@ const language2vectorMapForeign = (lang) => {
947
947
  }
948
948
  };
949
949
  const place2point = (place) => [Number(place.lng), Number(place.lat)];
950
+ const combineHandler = (fn1, fn2) => {
951
+ return (...args) => {
952
+ fn1 == null ? void 0 : fn1(...args);
953
+ return fn2(...args);
954
+ };
955
+ };
950
956
  const pipeAsync = (fn) => (...args) => {
951
957
  Promise.resolve().then(() => fn == null ? void 0 : fn(...args));
952
958
  };
@@ -1931,12 +1937,30 @@ const useMapLoader = (props) => {
1931
1937
  onChange
1932
1938
  });
1933
1939
  };
1940
+ var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1941
+ OS_PLATFORM2["IOS"] = "IOS";
1942
+ OS_PLATFORM2["ANDROID"] = "ANDROID";
1943
+ OS_PLATFORM2["OTHER"] = "OTHER";
1944
+ return OS_PLATFORM2;
1945
+ })(OS_PLATFORM || {});
1934
1946
  var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1935
1947
  WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
1936
1948
  WEBGL_STATUS2["DISABLED"] = "DISABLED";
1937
1949
  WEBGL_STATUS2["ENABLED"] = "ENABLED";
1938
1950
  return WEBGL_STATUS2;
1939
1951
  })(WEBGL_STATUS || {});
1952
+ const detectOSPlatform = () => {
1953
+ if (typeof navigator === "undefined")
1954
+ return "OTHER";
1955
+ const userAgent = navigator.userAgent || navigator.vendor;
1956
+ if (/android/i.test(userAgent)) {
1957
+ return "ANDROID";
1958
+ }
1959
+ if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
1960
+ return "IOS";
1961
+ }
1962
+ return "OTHER";
1963
+ };
1940
1964
  function detectWebGL() {
1941
1965
  if (typeof window === "undefined")
1942
1966
  return "NOT_SUPPORTED";
@@ -3163,6 +3187,71 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
3163
3187
  })]);
3164
3188
  };
3165
3189
  }).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to", "fromDescription", "log"]);
3190
+ const DEVICE_ORIENTATION_INTERVAL = 1e3;
3191
+ const CSS_DEVICE_ORIENTATION_VAR_PREFIX = "--CSS_DEVICE_ORIENTATION_VAR_ROTATION_DEGREE_";
3192
+ const useDeviceOrientation = (props) => {
3193
+ const { onChange, elementRef } = props;
3194
+ const orientation = Vue.reactive({ cssRotationVariableName: void 0 });
3195
+ const cssVarName = `${CSS_DEVICE_ORIENTATION_VAR_PREFIX}${Date.now()}`;
3196
+ Vue.watch(
3197
+ () => elementRef.value,
3198
+ (element, _, onCleanup) => {
3199
+ const handleDeviceOrientation = throttle((event) => {
3200
+ var _a, _b, _c, _d;
3201
+ const webkitCompassHeading = (_a = event.webkitCompassHeading) != null ? _a : void 0;
3202
+ const alpha = webkitCompassHeading !== void 0 ? 360 - webkitCompassHeading : (_b = event.alpha) != null ? _b : void 0;
3203
+ const beta = (_c = event.beta) != null ? _c : void 0;
3204
+ const gamma = (_d = event.gamma) != null ? _d : void 0;
3205
+ const cssRotationVariableValue = `${360 - (alpha != null ? alpha : 0)}deg`;
3206
+ const cssRotationVariableName = alpha === void 0 ? void 0 : cssVarName;
3207
+ Object.assign(orientation, { alpha, beta, gamma });
3208
+ if (orientation.cssRotationVariableName !== cssRotationVariableName) {
3209
+ orientation.cssRotationVariableName = cssRotationVariableName;
3210
+ }
3211
+ onChange == null ? void 0 : onChange({ alpha, beta, gamma, cssRotationVariableName });
3212
+ if (cssRotationVariableName) {
3213
+ element == null ? void 0 : element.style.setProperty(cssRotationVariableName, cssRotationVariableValue);
3214
+ }
3215
+ }, DEVICE_ORIENTATION_INTERVAL);
3216
+ compatibaleAddEventListenerDeviceOrientation(handleDeviceOrientation);
3217
+ onCleanup(() => {
3218
+ compatibleRemoveEventListenerDeviceOrientation(handleDeviceOrientation);
3219
+ element == null ? void 0 : element.style.removeProperty(cssVarName);
3220
+ });
3221
+ }
3222
+ );
3223
+ return { orientation };
3224
+ };
3225
+ let isIOSDeviceOrientationPermissionGranted = false;
3226
+ function compatibaleAddEventListenerDeviceOrientation(handler) {
3227
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3228
+ return addEventListener("deviceorientationabsolute", handler);
3229
+ }
3230
+ if (isIOSDeviceOrientationPermissionGranted) {
3231
+ return addEventListener("deviceorientation", handler);
3232
+ }
3233
+ const handleTouchEnd = () => {
3234
+ removeEventListener("touchend", handleTouchEnd);
3235
+ DeviceOrientationEvent == null ? void 0 : DeviceOrientationEvent.requestPermission().then((permissionState) => {
3236
+ if (permissionState === "granted") {
3237
+ isIOSDeviceOrientationPermissionGranted = true;
3238
+ addEventListener("deviceorientation", handler);
3239
+ }
3240
+ }).catch((err) => {
3241
+ if (err.name === "NotAllowedError") {
3242
+ addEventListener("touchend", handleTouchEnd);
3243
+ }
3244
+ console.error(err.name, err.message);
3245
+ });
3246
+ };
3247
+ addEventListener("touchend", handleTouchEnd);
3248
+ }
3249
+ function compatibleRemoveEventListenerDeviceOrientation(handler) {
3250
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3251
+ return removeEventListener("deviceorientationabsolute", handler);
3252
+ }
3253
+ return removeEventListener("deviceorientation", handler);
3254
+ }
3166
3255
  const watchVisibilityState = () => {
3167
3256
  const visibilityStateRef = Vue.ref(document.visibilityState);
3168
3257
  const handleVisibilityChange = () => {
@@ -3425,25 +3514,29 @@ const useGeoLocation = (props) => {
3425
3514
  };
3426
3515
  const useHeycarAmap = () => {
3427
3516
  const amapRef = Vue.shallowRef();
3517
+ const amapElementRef = Vue.shallowRef();
3428
3518
  const setMap = (map) => {
3429
3519
  amapRef.value = map;
3520
+ amapElementRef.value = map.getContainer();
3430
3521
  };
3431
3522
  const panTo = (value) => {
3432
3523
  var _a;
3433
3524
  return (_a = amapRef == null ? void 0 : amapRef.value) == null ? void 0 : _a.panTo(value);
3434
3525
  };
3435
- return { mapRef: amapRef, panTo, setMap };
3526
+ return { mapRef: amapRef, mapElementRef: amapElementRef, panTo, setMap };
3436
3527
  };
3437
3528
  const useHeycarGamp = () => {
3438
3529
  const gmapRef = Vue.shallowRef();
3530
+ const gmapElementRef = Vue.shallowRef();
3439
3531
  const setMap = (map) => {
3440
3532
  gmapRef.value = map;
3533
+ gmapElementRef.value = map.getDiv();
3441
3534
  };
3442
3535
  const panTo = (value) => {
3443
3536
  var _a;
3444
3537
  return (_a = gmapRef == null ? void 0 : gmapRef.value) == null ? void 0 : _a.panTo(vec2lnglat(value));
3445
3538
  };
3446
- return { mapRef: gmapRef, panTo, setMap };
3539
+ return { mapRef: gmapRef, mapElementRef: gmapElementRef, panTo, setMap };
3447
3540
  };
3448
3541
  const useHeycarMap = () => {
3449
3542
  const { supplier } = useMapSupplier();
@@ -3469,7 +3562,6 @@ const useAmapDrag = (props) => {
3469
3562
  zoomStartCenter = (_a = mapRef.value) == null ? void 0 : _a.getCenter().toJSON();
3470
3563
  };
3471
3564
  const handleChange = (value) => {
3472
- console.log("useAmapDrag value, zoomStartCenter = ", value, zoomStartCenter);
3473
3565
  if (isZoom) {
3474
3566
  isZoom = false;
3475
3567
  if (isPointEqual(value, zoomStartCenter))
@@ -5343,7 +5435,7 @@ const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaW
5343
5435
  const imgPassengerSmallArrow = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTI4LjYlIiB5PSItMjguNiUiIHdpZHRoPSIxNTcuMSUiIGhlaWdodD0iMTU3LjElIiBmaWx0ZXJVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIGlkPSJwcmVmaXhfX2EiPjxmZU9mZnNldCBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dCbHVyT3V0ZXIxIiBpbjI9IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0ib3V0IiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiLz48ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMjQgMCIgaW49InNoYWRvd0JsdXJPdXRlcjEiLz48L2ZpbHRlcj48Y2lyY2xlIGlkPSJwcmVmaXhfX2IiIGN4PSIxMC41IiBjeT0iMTkuNSIgcj0iMTAuNSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiM0NDcxRkYiIGQ9Ik0xNC40ODEgMGw2LjYwMyAxMy4xODFINy44Nzl6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNCkiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTAuNSIgY3k9IjE5LjUiIHI9IjkuMyIvPjwvZz48L2c+PC9zdmc+";
5344
5436
  const imgPassengerSmall = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI0IDAiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIi8+PC9maWx0ZXI+PGNpcmNsZSBpZD0icHJlZml4X19iIiBjeD0iMTU3IiBjeT0iMzUyIiByPSIxMCIvPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQzIC0zMzgpIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTU3IiBjeT0iMzUyIiByPSI4LjgiLz48L2c+PC9zdmc+";
5345
5437
  const PassengerCircle_css_ts_vanilla = "";
5346
- var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { size: { small: "_1l6offo1", large: "_1l6offo2" } }, defaultVariants: {}, compoundVariants: [] });
5438
+ var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { type: { small: "_1l6offo1", smallArrow: "_1l6offo2", large: "_1l6offo3", largeArrow: "_1l6offo4" } }, defaultVariants: {}, compoundVariants: [] });
5347
5439
  const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5348
5440
  const contentRef = Vue.computed(() => {
5349
5441
  const {
@@ -5351,10 +5443,12 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5351
5443
  angle
5352
5444
  } = props;
5353
5445
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5446
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5447
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5354
5448
  return `
5355
5449
  <img src="${src}" class="${passengerCircle({
5356
- size
5357
- })}">
5450
+ type
5451
+ })}" style="${style2}">
5358
5452
  `;
5359
5453
  });
5360
5454
  return () => {
@@ -5363,7 +5457,6 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5363
5457
  "position": props.position,
5364
5458
  "content": contentRef.value,
5365
5459
  "anchor": "bottom-center",
5366
- "angle": props.angle,
5367
5460
  "registerOverlay": props.registerOverlay,
5368
5461
  "zIndex": ZINDEX_PASSENGER_LAYER
5369
5462
  }
@@ -5377,10 +5470,11 @@ const GPassengerCircle = defineSetup(function GPassengerCircle2(props) {
5377
5470
  angle
5378
5471
  } = props;
5379
5472
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5380
- const style2 = angle === void 0 ? "" : `transform: rotate(${angle}deg)`;
5473
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5474
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5381
5475
  return createDom("img", {
5382
5476
  class: passengerCircle({
5383
- size
5477
+ type
5384
5478
  }),
5385
5479
  src,
5386
5480
  style: style2
@@ -5698,6 +5792,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5698
5792
  const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
5699
5793
  const {
5700
5794
  mapRef,
5795
+ mapElementRef,
5701
5796
  setMap,
5702
5797
  panTo
5703
5798
  } = useHeycarMap();
@@ -5752,6 +5847,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5752
5847
  const defaultCenterPlacePromise = new Promise((resolve) => {
5753
5848
  getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
5754
5849
  });
5850
+ const {
5851
+ orientation
5852
+ } = useDeviceOrientation({
5853
+ elementRef: mapElementRef
5854
+ });
5755
5855
  const {
5756
5856
  geoPosition,
5757
5857
  geoError,
@@ -5869,7 +5969,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5869
5969
  }
5870
5970
  }, [!geoLoading.value && !geoError.value && Vue.h(PassengerCircle, {
5871
5971
  "attrs": {
5872
- "position": geoPosition.value
5972
+ "position": geoPosition.value,
5973
+ "angle": orientation.cssRotationVariableName
5873
5974
  }
5874
5975
  }), zoomRef.value >= RECOMMEND_PLACE_ZOOM_MIN && Vue.h(PickupPoints, {
5875
5976
  "attrs": {
@@ -6826,42 +6927,30 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
6826
6927
  })]);
6827
6928
  };
6828
6929
  });
6829
- const DEVICE_ORIENTATION_INTERVAL = 100;
6830
- const useDeviceOrientation = (props) => {
6831
- const orientation = Vue.reactive({});
6832
- const { onChange } = props != null ? props : {};
6833
- Vue.watchEffect((onCleanup) => {
6834
- const handleDeviceOrientation = throttle((event) => {
6835
- var _a, _b, _c;
6836
- const alpha = (_a = event.alpha) != null ? _a : void 0;
6837
- const beta = (_b = event.beta) != null ? _b : void 0;
6838
- const gamma = (_c = event.gamma) != null ? _c : void 0;
6839
- Object.assign(orientation, { alpha, beta, gamma });
6840
- onChange == null ? void 0 : onChange({ alpha, beta, gamma });
6841
- }, DEVICE_ORIENTATION_INTERVAL);
6842
- addEventListener("deviceorientation", handleDeviceOrientation);
6843
- onCleanup(() => removeEventListener("deviceorientation", handleDeviceOrientation));
6844
- });
6845
- return { orientation };
6846
- };
6847
6930
  const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
6848
6931
  const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap2(props) {
6849
6932
  const {
6850
6933
  interval,
6851
6934
  registerOverlay,
6852
- mapRef,
6935
+ mapRef: outerSetMap,
6853
6936
  getDriverPosition,
6854
6937
  renderStartSerivceTitle,
6855
6938
  renderInServiceTitle
6856
6939
  } = props;
6857
6940
  const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
6941
+ const {
6942
+ setMap,
6943
+ mapElementRef
6944
+ } = useHeycarMap();
6858
6945
  const {
6859
6946
  geoPosition,
6860
6947
  geoError
6861
6948
  } = useGeoLocation();
6862
6949
  const {
6863
6950
  orientation
6864
- } = useDeviceOrientation();
6951
+ } = useDeviceOrientation({
6952
+ elementRef: mapElementRef
6953
+ });
6865
6954
  const carPositionRef = Vue.ref();
6866
6955
  const carAngleRef = Vue.ref();
6867
6956
  const {
@@ -6902,13 +6991,12 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6902
6991
  const carAngle = carAngleRef.value;
6903
6992
  const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
6904
6993
  const passengerPosition = geoError.value ? void 0 : geoPosition.value;
6905
- const passengerAngle = orientation.alpha === void 0 ? void 0 : 360 - orientation.alpha;
6906
- console.log("passengerAngle = ", passengerAngle);
6994
+ const passengerAngle = orientation.cssRotationVariableName;
6907
6995
  return Vue.h(HeycarMap, {
6908
6996
  "attrs": {
6909
6997
  "center": place2point(from),
6910
6998
  "zoom": 13,
6911
- "mapRef": mapRef,
6999
+ "mapRef": combineHandler(outerSetMap, setMap),
6912
7000
  "touchEnable": touchEnable
6913
7001
  },
6914
7002
  "on": {
package/dist/index.js CHANGED
@@ -945,6 +945,12 @@ const language2vectorMapForeign = (lang) => {
945
945
  }
946
946
  };
947
947
  const place2point = (place) => [Number(place.lng), Number(place.lat)];
948
+ const combineHandler = (fn1, fn2) => {
949
+ return (...args) => {
950
+ fn1 == null ? void 0 : fn1(...args);
951
+ return fn2(...args);
952
+ };
953
+ };
948
954
  const pipeAsync = (fn) => (...args) => {
949
955
  Promise.resolve().then(() => fn == null ? void 0 : fn(...args));
950
956
  };
@@ -1929,12 +1935,30 @@ const useMapLoader = (props) => {
1929
1935
  onChange
1930
1936
  });
1931
1937
  };
1938
+ var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1939
+ OS_PLATFORM2["IOS"] = "IOS";
1940
+ OS_PLATFORM2["ANDROID"] = "ANDROID";
1941
+ OS_PLATFORM2["OTHER"] = "OTHER";
1942
+ return OS_PLATFORM2;
1943
+ })(OS_PLATFORM || {});
1932
1944
  var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1933
1945
  WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
1934
1946
  WEBGL_STATUS2["DISABLED"] = "DISABLED";
1935
1947
  WEBGL_STATUS2["ENABLED"] = "ENABLED";
1936
1948
  return WEBGL_STATUS2;
1937
1949
  })(WEBGL_STATUS || {});
1950
+ const detectOSPlatform = () => {
1951
+ if (typeof navigator === "undefined")
1952
+ return "OTHER";
1953
+ const userAgent = navigator.userAgent || navigator.vendor;
1954
+ if (/android/i.test(userAgent)) {
1955
+ return "ANDROID";
1956
+ }
1957
+ if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
1958
+ return "IOS";
1959
+ }
1960
+ return "OTHER";
1961
+ };
1938
1962
  function detectWebGL() {
1939
1963
  if (typeof window === "undefined")
1940
1964
  return "NOT_SUPPORTED";
@@ -3161,6 +3185,71 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
3161
3185
  })]);
3162
3186
  };
3163
3187
  }).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to", "fromDescription", "log"]);
3188
+ const DEVICE_ORIENTATION_INTERVAL = 1e3;
3189
+ const CSS_DEVICE_ORIENTATION_VAR_PREFIX = "--CSS_DEVICE_ORIENTATION_VAR_ROTATION_DEGREE_";
3190
+ const useDeviceOrientation = (props) => {
3191
+ const { onChange, elementRef } = props;
3192
+ const orientation = reactive({ cssRotationVariableName: void 0 });
3193
+ const cssVarName = `${CSS_DEVICE_ORIENTATION_VAR_PREFIX}${Date.now()}`;
3194
+ watch(
3195
+ () => elementRef.value,
3196
+ (element, _, onCleanup) => {
3197
+ const handleDeviceOrientation = throttle((event) => {
3198
+ var _a, _b, _c, _d;
3199
+ const webkitCompassHeading = (_a = event.webkitCompassHeading) != null ? _a : void 0;
3200
+ const alpha = webkitCompassHeading !== void 0 ? 360 - webkitCompassHeading : (_b = event.alpha) != null ? _b : void 0;
3201
+ const beta = (_c = event.beta) != null ? _c : void 0;
3202
+ const gamma = (_d = event.gamma) != null ? _d : void 0;
3203
+ const cssRotationVariableValue = `${360 - (alpha != null ? alpha : 0)}deg`;
3204
+ const cssRotationVariableName = alpha === void 0 ? void 0 : cssVarName;
3205
+ Object.assign(orientation, { alpha, beta, gamma });
3206
+ if (orientation.cssRotationVariableName !== cssRotationVariableName) {
3207
+ orientation.cssRotationVariableName = cssRotationVariableName;
3208
+ }
3209
+ onChange == null ? void 0 : onChange({ alpha, beta, gamma, cssRotationVariableName });
3210
+ if (cssRotationVariableName) {
3211
+ element == null ? void 0 : element.style.setProperty(cssRotationVariableName, cssRotationVariableValue);
3212
+ }
3213
+ }, DEVICE_ORIENTATION_INTERVAL);
3214
+ compatibaleAddEventListenerDeviceOrientation(handleDeviceOrientation);
3215
+ onCleanup(() => {
3216
+ compatibleRemoveEventListenerDeviceOrientation(handleDeviceOrientation);
3217
+ element == null ? void 0 : element.style.removeProperty(cssVarName);
3218
+ });
3219
+ }
3220
+ );
3221
+ return { orientation };
3222
+ };
3223
+ let isIOSDeviceOrientationPermissionGranted = false;
3224
+ function compatibaleAddEventListenerDeviceOrientation(handler) {
3225
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3226
+ return addEventListener("deviceorientationabsolute", handler);
3227
+ }
3228
+ if (isIOSDeviceOrientationPermissionGranted) {
3229
+ return addEventListener("deviceorientation", handler);
3230
+ }
3231
+ const handleTouchEnd = () => {
3232
+ removeEventListener("touchend", handleTouchEnd);
3233
+ DeviceOrientationEvent == null ? void 0 : DeviceOrientationEvent.requestPermission().then((permissionState) => {
3234
+ if (permissionState === "granted") {
3235
+ isIOSDeviceOrientationPermissionGranted = true;
3236
+ addEventListener("deviceorientation", handler);
3237
+ }
3238
+ }).catch((err) => {
3239
+ if (err.name === "NotAllowedError") {
3240
+ addEventListener("touchend", handleTouchEnd);
3241
+ }
3242
+ console.error(err.name, err.message);
3243
+ });
3244
+ };
3245
+ addEventListener("touchend", handleTouchEnd);
3246
+ }
3247
+ function compatibleRemoveEventListenerDeviceOrientation(handler) {
3248
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3249
+ return removeEventListener("deviceorientationabsolute", handler);
3250
+ }
3251
+ return removeEventListener("deviceorientation", handler);
3252
+ }
3164
3253
  const watchVisibilityState = () => {
3165
3254
  const visibilityStateRef = ref(document.visibilityState);
3166
3255
  const handleVisibilityChange = () => {
@@ -3423,25 +3512,29 @@ const useGeoLocation = (props) => {
3423
3512
  };
3424
3513
  const useHeycarAmap = () => {
3425
3514
  const amapRef = shallowRef();
3515
+ const amapElementRef = shallowRef();
3426
3516
  const setMap = (map) => {
3427
3517
  amapRef.value = map;
3518
+ amapElementRef.value = map.getContainer();
3428
3519
  };
3429
3520
  const panTo = (value) => {
3430
3521
  var _a;
3431
3522
  return (_a = amapRef == null ? void 0 : amapRef.value) == null ? void 0 : _a.panTo(value);
3432
3523
  };
3433
- return { mapRef: amapRef, panTo, setMap };
3524
+ return { mapRef: amapRef, mapElementRef: amapElementRef, panTo, setMap };
3434
3525
  };
3435
3526
  const useHeycarGamp = () => {
3436
3527
  const gmapRef = shallowRef();
3528
+ const gmapElementRef = shallowRef();
3437
3529
  const setMap = (map) => {
3438
3530
  gmapRef.value = map;
3531
+ gmapElementRef.value = map.getDiv();
3439
3532
  };
3440
3533
  const panTo = (value) => {
3441
3534
  var _a;
3442
3535
  return (_a = gmapRef == null ? void 0 : gmapRef.value) == null ? void 0 : _a.panTo(vec2lnglat(value));
3443
3536
  };
3444
- return { mapRef: gmapRef, panTo, setMap };
3537
+ return { mapRef: gmapRef, mapElementRef: gmapElementRef, panTo, setMap };
3445
3538
  };
3446
3539
  const useHeycarMap = () => {
3447
3540
  const { supplier } = useMapSupplier();
@@ -3467,7 +3560,6 @@ const useAmapDrag = (props) => {
3467
3560
  zoomStartCenter = (_a = mapRef.value) == null ? void 0 : _a.getCenter().toJSON();
3468
3561
  };
3469
3562
  const handleChange = (value) => {
3470
- console.log("useAmapDrag value, zoomStartCenter = ", value, zoomStartCenter);
3471
3563
  if (isZoom) {
3472
3564
  isZoom = false;
3473
3565
  if (isPointEqual(value, zoomStartCenter))
@@ -5341,7 +5433,7 @@ const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaW
5341
5433
  const imgPassengerSmallArrow = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTI4LjYlIiB5PSItMjguNiUiIHdpZHRoPSIxNTcuMSUiIGhlaWdodD0iMTU3LjElIiBmaWx0ZXJVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIGlkPSJwcmVmaXhfX2EiPjxmZU9mZnNldCBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dCbHVyT3V0ZXIxIiBpbjI9IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0ib3V0IiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiLz48ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMjQgMCIgaW49InNoYWRvd0JsdXJPdXRlcjEiLz48L2ZpbHRlcj48Y2lyY2xlIGlkPSJwcmVmaXhfX2IiIGN4PSIxMC41IiBjeT0iMTkuNSIgcj0iMTAuNSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiM0NDcxRkYiIGQ9Ik0xNC40ODEgMGw2LjYwMyAxMy4xODFINy44Nzl6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNCkiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTAuNSIgY3k9IjE5LjUiIHI9IjkuMyIvPjwvZz48L2c+PC9zdmc+";
5342
5434
  const imgPassengerSmall = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI0IDAiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIi8+PC9maWx0ZXI+PGNpcmNsZSBpZD0icHJlZml4X19iIiBjeD0iMTU3IiBjeT0iMzUyIiByPSIxMCIvPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQzIC0zMzgpIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTU3IiBjeT0iMzUyIiByPSI4LjgiLz48L2c+PC9zdmc+";
5343
5435
  const PassengerCircle_css_ts_vanilla = "";
5344
- var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { size: { small: "_1l6offo1", large: "_1l6offo2" } }, defaultVariants: {}, compoundVariants: [] });
5436
+ var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { type: { small: "_1l6offo1", smallArrow: "_1l6offo2", large: "_1l6offo3", largeArrow: "_1l6offo4" } }, defaultVariants: {}, compoundVariants: [] });
5345
5437
  const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5346
5438
  const contentRef = computed(() => {
5347
5439
  const {
@@ -5349,10 +5441,12 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5349
5441
  angle
5350
5442
  } = props;
5351
5443
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5444
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5445
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5352
5446
  return `
5353
5447
  <img src="${src}" class="${passengerCircle({
5354
- size
5355
- })}">
5448
+ type
5449
+ })}" style="${style2}">
5356
5450
  `;
5357
5451
  });
5358
5452
  return () => {
@@ -5361,7 +5455,6 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5361
5455
  "position": props.position,
5362
5456
  "content": contentRef.value,
5363
5457
  "anchor": "bottom-center",
5364
- "angle": props.angle,
5365
5458
  "registerOverlay": props.registerOverlay,
5366
5459
  "zIndex": ZINDEX_PASSENGER_LAYER
5367
5460
  }
@@ -5375,10 +5468,11 @@ const GPassengerCircle = defineSetup(function GPassengerCircle2(props) {
5375
5468
  angle
5376
5469
  } = props;
5377
5470
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5378
- const style2 = angle === void 0 ? "" : `transform: rotate(${angle}deg)`;
5471
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5472
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5379
5473
  return createDom("img", {
5380
5474
  class: passengerCircle({
5381
- size
5475
+ type
5382
5476
  }),
5383
5477
  src,
5384
5478
  style: style2
@@ -5696,6 +5790,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5696
5790
  const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
5697
5791
  const {
5698
5792
  mapRef,
5793
+ mapElementRef,
5699
5794
  setMap,
5700
5795
  panTo
5701
5796
  } = useHeycarMap();
@@ -5750,6 +5845,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5750
5845
  const defaultCenterPlacePromise = new Promise((resolve) => {
5751
5846
  getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
5752
5847
  });
5848
+ const {
5849
+ orientation
5850
+ } = useDeviceOrientation({
5851
+ elementRef: mapElementRef
5852
+ });
5753
5853
  const {
5754
5854
  geoPosition,
5755
5855
  geoError,
@@ -5867,7 +5967,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5867
5967
  }
5868
5968
  }, [!geoLoading.value && !geoError.value && h(PassengerCircle, {
5869
5969
  "attrs": {
5870
- "position": geoPosition.value
5970
+ "position": geoPosition.value,
5971
+ "angle": orientation.cssRotationVariableName
5871
5972
  }
5872
5973
  }), zoomRef.value >= RECOMMEND_PLACE_ZOOM_MIN && h(PickupPoints, {
5873
5974
  "attrs": {
@@ -6824,42 +6925,30 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
6824
6925
  })]);
6825
6926
  };
6826
6927
  });
6827
- const DEVICE_ORIENTATION_INTERVAL = 100;
6828
- const useDeviceOrientation = (props) => {
6829
- const orientation = reactive({});
6830
- const { onChange } = props != null ? props : {};
6831
- watchEffect((onCleanup) => {
6832
- const handleDeviceOrientation = throttle((event) => {
6833
- var _a, _b, _c;
6834
- const alpha = (_a = event.alpha) != null ? _a : void 0;
6835
- const beta = (_b = event.beta) != null ? _b : void 0;
6836
- const gamma = (_c = event.gamma) != null ? _c : void 0;
6837
- Object.assign(orientation, { alpha, beta, gamma });
6838
- onChange == null ? void 0 : onChange({ alpha, beta, gamma });
6839
- }, DEVICE_ORIENTATION_INTERVAL);
6840
- addEventListener("deviceorientation", handleDeviceOrientation);
6841
- onCleanup(() => removeEventListener("deviceorientation", handleDeviceOrientation));
6842
- });
6843
- return { orientation };
6844
- };
6845
6928
  const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
6846
6929
  const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap2(props) {
6847
6930
  const {
6848
6931
  interval,
6849
6932
  registerOverlay,
6850
- mapRef,
6933
+ mapRef: outerSetMap,
6851
6934
  getDriverPosition,
6852
6935
  renderStartSerivceTitle,
6853
6936
  renderInServiceTitle
6854
6937
  } = props;
6855
6938
  const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
6939
+ const {
6940
+ setMap,
6941
+ mapElementRef
6942
+ } = useHeycarMap();
6856
6943
  const {
6857
6944
  geoPosition,
6858
6945
  geoError
6859
6946
  } = useGeoLocation();
6860
6947
  const {
6861
6948
  orientation
6862
- } = useDeviceOrientation();
6949
+ } = useDeviceOrientation({
6950
+ elementRef: mapElementRef
6951
+ });
6863
6952
  const carPositionRef = ref();
6864
6953
  const carAngleRef = ref();
6865
6954
  const {
@@ -6900,13 +6989,12 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6900
6989
  const carAngle = carAngleRef.value;
6901
6990
  const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
6902
6991
  const passengerPosition = geoError.value ? void 0 : geoPosition.value;
6903
- const passengerAngle = orientation.alpha === void 0 ? void 0 : 360 - orientation.alpha;
6904
- console.log("passengerAngle = ", passengerAngle);
6992
+ const passengerAngle = orientation.cssRotationVariableName;
6905
6993
  return h(HeycarMap, {
6906
6994
  "attrs": {
6907
6995
  "center": place2point(from),
6908
6996
  "zoom": 13,
6909
- "mapRef": mapRef,
6997
+ "mapRef": combineHandler(outerSetMap, setMap),
6910
6998
  "touchEnable": touchEnable
6911
6999
  },
6912
7000
  "on": {
package/dist/style.css CHANGED
@@ -206,6 +206,17 @@ a[title*="Google"]>div>img[alt="Google"], .gmnoprint {
206
206
  margin-bottom: -3.3vw;
207
207
  }
208
208
  ._1l6offo2 {
209
+ width: 6.6vw;
210
+ height: 7.738vw;
211
+ margin-bottom: -3.3vw;
212
+ transform-origin: center 4.438vw;
213
+ }
214
+ ._1l6offo3 {
215
+ width: 16.27vw;
216
+ height: 16.27vw;
217
+ margin-bottom: -8.135vw;
218
+ }
219
+ ._1l6offo4 {
209
220
  width: 16.27vw;
210
221
  height: 16.27vw;
211
222
  margin-bottom: -8.135vw;
@@ -12,6 +12,7 @@ export declare const property2mapEventName: (propertyName: string) => string;
12
12
  export type VectorMapForeign = "style_en" | "style_local" | "style_zh_cn";
13
13
  export declare const language2vectorMapForeign: (lang: "en" | "zh") => VectorMapForeign;
14
14
  export declare const place2point: (place: Place) => Point;
15
+ export declare const combineHandler: <P extends any[], R>(fn1: ((...args: P) => any) | undefined, fn2: (...args: P) => R) => (...args: P) => R;
15
16
  export declare const pipeAsync: <P extends any[]>(fn?: ((...args: P) => any) | undefined) => (...args: P) => void;
16
17
  export declare const pipeDefer: <P extends any[], R>(fn: (...args: P) => R) => (...args: P) => Promise<R>;
17
18
  export declare const pipeOnlyLastEffect: <P extends any[], R>(fn: (...arg: P) => Promise<R>) => (...args: P) => Promise<R>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",