@heycar/heycars-map 0.7.0 → 0.7.1

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,65 @@ 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;
3201
+ const alpha = (_a = event.alpha) != null ? _a : void 0;
3202
+ const beta = (_b = event.beta) != null ? _b : void 0;
3203
+ const gamma = (_c = event.gamma) != null ? _c : void 0;
3204
+ const cssRotationVariableValue = `${360 - (alpha != null ? alpha : 0)}deg`;
3205
+ const cssRotationVariableName = alpha === void 0 ? void 0 : cssVarName;
3206
+ Object.assign(orientation, { alpha, beta, gamma });
3207
+ if (orientation.cssRotationVariableName !== cssRotationVariableName) {
3208
+ orientation.cssRotationVariableName = cssRotationVariableName;
3209
+ }
3210
+ onChange == null ? void 0 : onChange({ alpha, beta, gamma, cssRotationVariableName });
3211
+ if (cssRotationVariableName) {
3212
+ element == null ? void 0 : element.style.setProperty(cssRotationVariableName, cssRotationVariableValue);
3213
+ }
3214
+ }, DEVICE_ORIENTATION_INTERVAL);
3215
+ compatibaleAddEventListenerDeviceOrientation(handleDeviceOrientation);
3216
+ onCleanup(() => {
3217
+ compatibleRemoveEventListenerDeviceOrientation(handleDeviceOrientation);
3218
+ element == null ? void 0 : element.style.removeProperty(cssVarName);
3219
+ });
3220
+ }
3221
+ );
3222
+ return { orientation };
3223
+ };
3224
+ let isIOSDeviceOrientationPermissionGranted = false;
3225
+ function compatibaleAddEventListenerDeviceOrientation(handler) {
3226
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3227
+ return addEventListener("deviceorientationabsolute", handler);
3228
+ }
3229
+ if (isIOSDeviceOrientationPermissionGranted) {
3230
+ return addEventListener("deviceorientation", handler);
3231
+ }
3232
+ const handleTouchEnd = () => {
3233
+ removeEventListener("touchend", handleTouchEnd);
3234
+ DeviceOrientationEvent == null ? void 0 : DeviceOrientationEvent.requestPermission().then((permissionState) => {
3235
+ if (permissionState === "granted") {
3236
+ isIOSDeviceOrientationPermissionGranted = true;
3237
+ addEventListener("deviceorientation", handler);
3238
+ }
3239
+ }).catch((err) => console.error(err.message));
3240
+ };
3241
+ addEventListener("touchend", handleTouchEnd);
3242
+ }
3243
+ function compatibleRemoveEventListenerDeviceOrientation(handler) {
3244
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3245
+ return removeEventListener("deviceorientationabsolute", handler);
3246
+ }
3247
+ return removeEventListener("deviceorientation", handler);
3248
+ }
3166
3249
  const watchVisibilityState = () => {
3167
3250
  const visibilityStateRef = Vue.ref(document.visibilityState);
3168
3251
  const handleVisibilityChange = () => {
@@ -3425,25 +3508,29 @@ const useGeoLocation = (props) => {
3425
3508
  };
3426
3509
  const useHeycarAmap = () => {
3427
3510
  const amapRef = Vue.shallowRef();
3511
+ const amapElementRef = Vue.shallowRef();
3428
3512
  const setMap = (map) => {
3429
3513
  amapRef.value = map;
3514
+ amapElementRef.value = map.getContainer();
3430
3515
  };
3431
3516
  const panTo = (value) => {
3432
3517
  var _a;
3433
3518
  return (_a = amapRef == null ? void 0 : amapRef.value) == null ? void 0 : _a.panTo(value);
3434
3519
  };
3435
- return { mapRef: amapRef, panTo, setMap };
3520
+ return { mapRef: amapRef, mapElementRef: amapElementRef, panTo, setMap };
3436
3521
  };
3437
3522
  const useHeycarGamp = () => {
3438
3523
  const gmapRef = Vue.shallowRef();
3524
+ const gmapElementRef = Vue.shallowRef();
3439
3525
  const setMap = (map) => {
3440
3526
  gmapRef.value = map;
3527
+ gmapElementRef.value = map.getDiv();
3441
3528
  };
3442
3529
  const panTo = (value) => {
3443
3530
  var _a;
3444
3531
  return (_a = gmapRef == null ? void 0 : gmapRef.value) == null ? void 0 : _a.panTo(vec2lnglat(value));
3445
3532
  };
3446
- return { mapRef: gmapRef, panTo, setMap };
3533
+ return { mapRef: gmapRef, mapElementRef: gmapElementRef, panTo, setMap };
3447
3534
  };
3448
3535
  const useHeycarMap = () => {
3449
3536
  const { supplier } = useMapSupplier();
@@ -3469,7 +3556,6 @@ const useAmapDrag = (props) => {
3469
3556
  zoomStartCenter = (_a = mapRef.value) == null ? void 0 : _a.getCenter().toJSON();
3470
3557
  };
3471
3558
  const handleChange = (value) => {
3472
- console.log("useAmapDrag value, zoomStartCenter = ", value, zoomStartCenter);
3473
3559
  if (isZoom) {
3474
3560
  isZoom = false;
3475
3561
  if (isPointEqual(value, zoomStartCenter))
@@ -5343,7 +5429,7 @@ const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaW
5343
5429
  const imgPassengerSmallArrow = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTI4LjYlIiB5PSItMjguNiUiIHdpZHRoPSIxNTcuMSUiIGhlaWdodD0iMTU3LjElIiBmaWx0ZXJVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIGlkPSJwcmVmaXhfX2EiPjxmZU9mZnNldCBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dCbHVyT3V0ZXIxIiBpbjI9IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0ib3V0IiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiLz48ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMjQgMCIgaW49InNoYWRvd0JsdXJPdXRlcjEiLz48L2ZpbHRlcj48Y2lyY2xlIGlkPSJwcmVmaXhfX2IiIGN4PSIxMC41IiBjeT0iMTkuNSIgcj0iMTAuNSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiM0NDcxRkYiIGQ9Ik0xNC40ODEgMGw2LjYwMyAxMy4xODFINy44Nzl6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNCkiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTAuNSIgY3k9IjE5LjUiIHI9IjkuMyIvPjwvZz48L2c+PC9zdmc+";
5344
5430
  const imgPassengerSmall = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI0IDAiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIi8+PC9maWx0ZXI+PGNpcmNsZSBpZD0icHJlZml4X19iIiBjeD0iMTU3IiBjeT0iMzUyIiByPSIxMCIvPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQzIC0zMzgpIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTU3IiBjeT0iMzUyIiByPSI4LjgiLz48L2c+PC9zdmc+";
5345
5431
  const PassengerCircle_css_ts_vanilla = "";
5346
- var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { size: { small: "_1l6offo1", large: "_1l6offo2" } }, defaultVariants: {}, compoundVariants: [] });
5432
+ var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { type: { small: "_1l6offo1", smallArrow: "_1l6offo2", large: "_1l6offo3", largeArrow: "_1l6offo4" } }, defaultVariants: {}, compoundVariants: [] });
5347
5433
  const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5348
5434
  const contentRef = Vue.computed(() => {
5349
5435
  const {
@@ -5351,10 +5437,12 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5351
5437
  angle
5352
5438
  } = props;
5353
5439
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5440
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5441
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5354
5442
  return `
5355
5443
  <img src="${src}" class="${passengerCircle({
5356
- size
5357
- })}">
5444
+ type
5445
+ })}" style="${style2}">
5358
5446
  `;
5359
5447
  });
5360
5448
  return () => {
@@ -5363,7 +5451,6 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5363
5451
  "position": props.position,
5364
5452
  "content": contentRef.value,
5365
5453
  "anchor": "bottom-center",
5366
- "angle": props.angle,
5367
5454
  "registerOverlay": props.registerOverlay,
5368
5455
  "zIndex": ZINDEX_PASSENGER_LAYER
5369
5456
  }
@@ -5377,10 +5464,11 @@ const GPassengerCircle = defineSetup(function GPassengerCircle2(props) {
5377
5464
  angle
5378
5465
  } = props;
5379
5466
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5380
- const style2 = angle === void 0 ? "" : `transform: rotate(${angle}deg)`;
5467
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5468
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5381
5469
  return createDom("img", {
5382
5470
  class: passengerCircle({
5383
- size
5471
+ type
5384
5472
  }),
5385
5473
  src,
5386
5474
  style: style2
@@ -5698,6 +5786,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5698
5786
  const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
5699
5787
  const {
5700
5788
  mapRef,
5789
+ mapElementRef,
5701
5790
  setMap,
5702
5791
  panTo
5703
5792
  } = useHeycarMap();
@@ -5752,6 +5841,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5752
5841
  const defaultCenterPlacePromise = new Promise((resolve) => {
5753
5842
  getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
5754
5843
  });
5844
+ const {
5845
+ orientation
5846
+ } = useDeviceOrientation({
5847
+ elementRef: mapElementRef
5848
+ });
5755
5849
  const {
5756
5850
  geoPosition,
5757
5851
  geoError,
@@ -5869,7 +5963,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5869
5963
  }
5870
5964
  }, [!geoLoading.value && !geoError.value && Vue.h(PassengerCircle, {
5871
5965
  "attrs": {
5872
- "position": geoPosition.value
5966
+ "position": geoPosition.value,
5967
+ "angle": orientation.cssRotationVariableName
5873
5968
  }
5874
5969
  }), zoomRef.value >= RECOMMEND_PLACE_ZOOM_MIN && Vue.h(PickupPoints, {
5875
5970
  "attrs": {
@@ -6826,42 +6921,30 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
6826
6921
  })]);
6827
6922
  };
6828
6923
  });
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
6924
  const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
6848
6925
  const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap2(props) {
6849
6926
  const {
6850
6927
  interval,
6851
6928
  registerOverlay,
6852
- mapRef,
6929
+ mapRef: outerSetMap,
6853
6930
  getDriverPosition,
6854
6931
  renderStartSerivceTitle,
6855
6932
  renderInServiceTitle
6856
6933
  } = props;
6857
6934
  const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
6935
+ const {
6936
+ setMap,
6937
+ mapElementRef
6938
+ } = useHeycarMap();
6858
6939
  const {
6859
6940
  geoPosition,
6860
6941
  geoError
6861
6942
  } = useGeoLocation();
6862
6943
  const {
6863
6944
  orientation
6864
- } = useDeviceOrientation();
6945
+ } = useDeviceOrientation({
6946
+ elementRef: mapElementRef
6947
+ });
6865
6948
  const carPositionRef = Vue.ref();
6866
6949
  const carAngleRef = Vue.ref();
6867
6950
  const {
@@ -6902,13 +6985,12 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6902
6985
  const carAngle = carAngleRef.value;
6903
6986
  const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
6904
6987
  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);
6988
+ const passengerAngle = orientation.cssRotationVariableName;
6907
6989
  return Vue.h(HeycarMap, {
6908
6990
  "attrs": {
6909
6991
  "center": place2point(from),
6910
6992
  "zoom": 13,
6911
- "mapRef": mapRef,
6993
+ "mapRef": combineHandler(outerSetMap, setMap),
6912
6994
  "touchEnable": touchEnable
6913
6995
  },
6914
6996
  "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,65 @@ 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;
3199
+ const alpha = (_a = event.alpha) != null ? _a : void 0;
3200
+ const beta = (_b = event.beta) != null ? _b : void 0;
3201
+ const gamma = (_c = event.gamma) != null ? _c : void 0;
3202
+ const cssRotationVariableValue = `${360 - (alpha != null ? alpha : 0)}deg`;
3203
+ const cssRotationVariableName = alpha === void 0 ? void 0 : cssVarName;
3204
+ Object.assign(orientation, { alpha, beta, gamma });
3205
+ if (orientation.cssRotationVariableName !== cssRotationVariableName) {
3206
+ orientation.cssRotationVariableName = cssRotationVariableName;
3207
+ }
3208
+ onChange == null ? void 0 : onChange({ alpha, beta, gamma, cssRotationVariableName });
3209
+ if (cssRotationVariableName) {
3210
+ element == null ? void 0 : element.style.setProperty(cssRotationVariableName, cssRotationVariableValue);
3211
+ }
3212
+ }, DEVICE_ORIENTATION_INTERVAL);
3213
+ compatibaleAddEventListenerDeviceOrientation(handleDeviceOrientation);
3214
+ onCleanup(() => {
3215
+ compatibleRemoveEventListenerDeviceOrientation(handleDeviceOrientation);
3216
+ element == null ? void 0 : element.style.removeProperty(cssVarName);
3217
+ });
3218
+ }
3219
+ );
3220
+ return { orientation };
3221
+ };
3222
+ let isIOSDeviceOrientationPermissionGranted = false;
3223
+ function compatibaleAddEventListenerDeviceOrientation(handler) {
3224
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3225
+ return addEventListener("deviceorientationabsolute", handler);
3226
+ }
3227
+ if (isIOSDeviceOrientationPermissionGranted) {
3228
+ return addEventListener("deviceorientation", handler);
3229
+ }
3230
+ const handleTouchEnd = () => {
3231
+ removeEventListener("touchend", handleTouchEnd);
3232
+ DeviceOrientationEvent == null ? void 0 : DeviceOrientationEvent.requestPermission().then((permissionState) => {
3233
+ if (permissionState === "granted") {
3234
+ isIOSDeviceOrientationPermissionGranted = true;
3235
+ addEventListener("deviceorientation", handler);
3236
+ }
3237
+ }).catch((err) => console.error(err.message));
3238
+ };
3239
+ addEventListener("touchend", handleTouchEnd);
3240
+ }
3241
+ function compatibleRemoveEventListenerDeviceOrientation(handler) {
3242
+ if (detectOSPlatform() === OS_PLATFORM.ANDROID) {
3243
+ return removeEventListener("deviceorientationabsolute", handler);
3244
+ }
3245
+ return removeEventListener("deviceorientation", handler);
3246
+ }
3164
3247
  const watchVisibilityState = () => {
3165
3248
  const visibilityStateRef = ref(document.visibilityState);
3166
3249
  const handleVisibilityChange = () => {
@@ -3423,25 +3506,29 @@ const useGeoLocation = (props) => {
3423
3506
  };
3424
3507
  const useHeycarAmap = () => {
3425
3508
  const amapRef = shallowRef();
3509
+ const amapElementRef = shallowRef();
3426
3510
  const setMap = (map) => {
3427
3511
  amapRef.value = map;
3512
+ amapElementRef.value = map.getContainer();
3428
3513
  };
3429
3514
  const panTo = (value) => {
3430
3515
  var _a;
3431
3516
  return (_a = amapRef == null ? void 0 : amapRef.value) == null ? void 0 : _a.panTo(value);
3432
3517
  };
3433
- return { mapRef: amapRef, panTo, setMap };
3518
+ return { mapRef: amapRef, mapElementRef: amapElementRef, panTo, setMap };
3434
3519
  };
3435
3520
  const useHeycarGamp = () => {
3436
3521
  const gmapRef = shallowRef();
3522
+ const gmapElementRef = shallowRef();
3437
3523
  const setMap = (map) => {
3438
3524
  gmapRef.value = map;
3525
+ gmapElementRef.value = map.getDiv();
3439
3526
  };
3440
3527
  const panTo = (value) => {
3441
3528
  var _a;
3442
3529
  return (_a = gmapRef == null ? void 0 : gmapRef.value) == null ? void 0 : _a.panTo(vec2lnglat(value));
3443
3530
  };
3444
- return { mapRef: gmapRef, panTo, setMap };
3531
+ return { mapRef: gmapRef, mapElementRef: gmapElementRef, panTo, setMap };
3445
3532
  };
3446
3533
  const useHeycarMap = () => {
3447
3534
  const { supplier } = useMapSupplier();
@@ -3467,7 +3554,6 @@ const useAmapDrag = (props) => {
3467
3554
  zoomStartCenter = (_a = mapRef.value) == null ? void 0 : _a.getCenter().toJSON();
3468
3555
  };
3469
3556
  const handleChange = (value) => {
3470
- console.log("useAmapDrag value, zoomStartCenter = ", value, zoomStartCenter);
3471
3557
  if (isZoom) {
3472
3558
  isZoom = false;
3473
3559
  if (isPointEqual(value, zoomStartCenter))
@@ -5341,7 +5427,7 @@ const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaW
5341
5427
  const imgPassengerSmallArrow = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTI4LjYlIiB5PSItMjguNiUiIHdpZHRoPSIxNTcuMSUiIGhlaWdodD0iMTU3LjElIiBmaWx0ZXJVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIGlkPSJwcmVmaXhfX2EiPjxmZU9mZnNldCBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dCbHVyT3V0ZXIxIiBpbjI9IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0ib3V0IiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiLz48ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMjQgMCIgaW49InNoYWRvd0JsdXJPdXRlcjEiLz48L2ZpbHRlcj48Y2lyY2xlIGlkPSJwcmVmaXhfX2IiIGN4PSIxMC41IiBjeT0iMTkuNSIgcj0iMTAuNSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGZpbGw9IiM0NDcxRkYiIGQ9Ik0xNC40ODEgMGw2LjYwMyAxMy4xODFINy44Nzl6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNCkiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTAuNSIgY3k9IjE5LjUiIHI9IjkuMyIvPjwvZz48L2c+PC9zdmc+";
5342
5428
  const imgPassengerSmall = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI0IDAiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIi8+PC9maWx0ZXI+PGNpcmNsZSBpZD0icHJlZml4X19iIiBjeD0iMTU3IiBjeT0iMzUyIiByPSIxMCIvPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQzIC0zMzgpIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTU3IiBjeT0iMzUyIiByPSI4LjgiLz48L2c+PC9zdmc+";
5343
5429
  const PassengerCircle_css_ts_vanilla = "";
5344
- var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { size: { small: "_1l6offo1", large: "_1l6offo2" } }, defaultVariants: {}, compoundVariants: [] });
5430
+ var passengerCircle = createRuntimeFn({ defaultClassName: "_1l6offo0", variantClassNames: { type: { small: "_1l6offo1", smallArrow: "_1l6offo2", large: "_1l6offo3", largeArrow: "_1l6offo4" } }, defaultVariants: {}, compoundVariants: [] });
5345
5431
  const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5346
5432
  const contentRef = computed(() => {
5347
5433
  const {
@@ -5349,10 +5435,12 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5349
5435
  angle
5350
5436
  } = props;
5351
5437
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5438
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5439
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5352
5440
  return `
5353
5441
  <img src="${src}" class="${passengerCircle({
5354
- size
5355
- })}">
5442
+ type
5443
+ })}" style="${style2}">
5356
5444
  `;
5357
5445
  });
5358
5446
  return () => {
@@ -5361,7 +5449,6 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
5361
5449
  "position": props.position,
5362
5450
  "content": contentRef.value,
5363
5451
  "anchor": "bottom-center",
5364
- "angle": props.angle,
5365
5452
  "registerOverlay": props.registerOverlay,
5366
5453
  "zIndex": ZINDEX_PASSENGER_LAYER
5367
5454
  }
@@ -5375,10 +5462,11 @@ const GPassengerCircle = defineSetup(function GPassengerCircle2(props) {
5375
5462
  angle
5376
5463
  } = props;
5377
5464
  const src = size === "large" ? angle === void 0 ? imgPassengerCircle : imgPassengerCircleArrow : angle === void 0 ? imgPassengerSmall : imgPassengerSmallArrow;
5378
- const style2 = angle === void 0 ? "" : `transform: rotate(${angle}deg)`;
5465
+ const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
5466
+ const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
5379
5467
  return createDom("img", {
5380
5468
  class: passengerCircle({
5381
- size
5469
+ type
5382
5470
  }),
5383
5471
  src,
5384
5472
  style: style2
@@ -5696,6 +5784,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5696
5784
  const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
5697
5785
  const {
5698
5786
  mapRef,
5787
+ mapElementRef,
5699
5788
  setMap,
5700
5789
  panTo
5701
5790
  } = useHeycarMap();
@@ -5750,6 +5839,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5750
5839
  const defaultCenterPlacePromise = new Promise((resolve) => {
5751
5840
  getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
5752
5841
  });
5842
+ const {
5843
+ orientation
5844
+ } = useDeviceOrientation({
5845
+ elementRef: mapElementRef
5846
+ });
5753
5847
  const {
5754
5848
  geoPosition,
5755
5849
  geoError,
@@ -5867,7 +5961,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
5867
5961
  }
5868
5962
  }, [!geoLoading.value && !geoError.value && h(PassengerCircle, {
5869
5963
  "attrs": {
5870
- "position": geoPosition.value
5964
+ "position": geoPosition.value,
5965
+ "angle": orientation.cssRotationVariableName
5871
5966
  }
5872
5967
  }), zoomRef.value >= RECOMMEND_PLACE_ZOOM_MIN && h(PickupPoints, {
5873
5968
  "attrs": {
@@ -6824,42 +6919,30 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
6824
6919
  })]);
6825
6920
  };
6826
6921
  });
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
6922
  const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
6846
6923
  const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap2(props) {
6847
6924
  const {
6848
6925
  interval,
6849
6926
  registerOverlay,
6850
- mapRef,
6927
+ mapRef: outerSetMap,
6851
6928
  getDriverPosition,
6852
6929
  renderStartSerivceTitle,
6853
6930
  renderInServiceTitle
6854
6931
  } = props;
6855
6932
  const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
6933
+ const {
6934
+ setMap,
6935
+ mapElementRef
6936
+ } = useHeycarMap();
6856
6937
  const {
6857
6938
  geoPosition,
6858
6939
  geoError
6859
6940
  } = useGeoLocation();
6860
6941
  const {
6861
6942
  orientation
6862
- } = useDeviceOrientation();
6943
+ } = useDeviceOrientation({
6944
+ elementRef: mapElementRef
6945
+ });
6863
6946
  const carPositionRef = ref();
6864
6947
  const carAngleRef = ref();
6865
6948
  const {
@@ -6900,13 +6983,12 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6900
6983
  const carAngle = carAngleRef.value;
6901
6984
  const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
6902
6985
  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);
6986
+ const passengerAngle = orientation.cssRotationVariableName;
6905
6987
  return h(HeycarMap, {
6906
6988
  "attrs": {
6907
6989
  "center": place2point(from),
6908
6990
  "zoom": 13,
6909
- "mapRef": mapRef,
6991
+ "mapRef": combineHandler(outerSetMap, setMap),
6910
6992
  "touchEnable": touchEnable
6911
6993
  },
6912
6994
  "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.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",