@heycar/heycars-map 0.7.1 → 0.7.3

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.
package/dist/index.cjs CHANGED
@@ -2058,8 +2058,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2058
2058
  const map = new AMap.Map(elementRef.value, {
2059
2059
  ...defaultOptions,
2060
2060
  scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
2061
- vectorMapForeign,
2062
- mapStyle: "amap://styles/95498a904992a4c0b866a3e4d7729682"
2061
+ vectorMapForeign
2063
2062
  });
2064
2063
  window.GlobalAmap = map;
2065
2064
  mapRef.value = map;
@@ -3197,10 +3196,11 @@ const useDeviceOrientation = (props) => {
3197
3196
  () => elementRef.value,
3198
3197
  (element, _, onCleanup) => {
3199
3198
  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;
3199
+ var _a, _b, _c, _d;
3200
+ const webkitCompassHeading = (_a = event.webkitCompassHeading) != null ? _a : void 0;
3201
+ const alpha = webkitCompassHeading !== void 0 ? 360 - webkitCompassHeading : (_b = event.alpha) != null ? _b : void 0;
3202
+ const beta = (_c = event.beta) != null ? _c : void 0;
3203
+ const gamma = (_d = event.gamma) != null ? _d : void 0;
3204
3204
  const cssRotationVariableValue = `${360 - (alpha != null ? alpha : 0)}deg`;
3205
3205
  const cssRotationVariableName = alpha === void 0 ? void 0 : cssVarName;
3206
3206
  Object.assign(orientation, { alpha, beta, gamma });
@@ -3236,7 +3236,12 @@ function compatibaleAddEventListenerDeviceOrientation(handler) {
3236
3236
  isIOSDeviceOrientationPermissionGranted = true;
3237
3237
  addEventListener("deviceorientation", handler);
3238
3238
  }
3239
- }).catch((err) => console.error(err.message));
3239
+ }).catch((err) => {
3240
+ if (err.name === "NotAllowedError") {
3241
+ addEventListener("touchend", handleTouchEnd);
3242
+ }
3243
+ console.error(err.name, err.message);
3244
+ });
3240
3245
  };
3241
3246
  addEventListener("touchend", handleTouchEnd);
3242
3247
  }
package/dist/index.js CHANGED
@@ -2056,8 +2056,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2056
2056
  const map = new AMap.Map(elementRef.value, {
2057
2057
  ...defaultOptions,
2058
2058
  scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
2059
- vectorMapForeign,
2060
- mapStyle: "amap://styles/95498a904992a4c0b866a3e4d7729682"
2059
+ vectorMapForeign
2061
2060
  });
2062
2061
  window.GlobalAmap = map;
2063
2062
  mapRef.value = map;
@@ -3195,10 +3194,11 @@ const useDeviceOrientation = (props) => {
3195
3194
  () => elementRef.value,
3196
3195
  (element, _, onCleanup) => {
3197
3196
  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;
3197
+ var _a, _b, _c, _d;
3198
+ const webkitCompassHeading = (_a = event.webkitCompassHeading) != null ? _a : void 0;
3199
+ const alpha = webkitCompassHeading !== void 0 ? 360 - webkitCompassHeading : (_b = event.alpha) != null ? _b : void 0;
3200
+ const beta = (_c = event.beta) != null ? _c : void 0;
3201
+ const gamma = (_d = event.gamma) != null ? _d : void 0;
3202
3202
  const cssRotationVariableValue = `${360 - (alpha != null ? alpha : 0)}deg`;
3203
3203
  const cssRotationVariableName = alpha === void 0 ? void 0 : cssVarName;
3204
3204
  Object.assign(orientation, { alpha, beta, gamma });
@@ -3234,7 +3234,12 @@ function compatibaleAddEventListenerDeviceOrientation(handler) {
3234
3234
  isIOSDeviceOrientationPermissionGranted = true;
3235
3235
  addEventListener("deviceorientation", handler);
3236
3236
  }
3237
- }).catch((err) => console.error(err.message));
3237
+ }).catch((err) => {
3238
+ if (err.name === "NotAllowedError") {
3239
+ addEventListener("touchend", handleTouchEnd);
3240
+ }
3241
+ console.error(err.name, err.message);
3242
+ });
3238
3243
  };
3239
3244
  addEventListener("touchend", handleTouchEnd);
3240
3245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",