@heycar/heycars-map 0.7.7-animate2 → 0.7.8

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
@@ -1937,6 +1937,15 @@ const useMapLoader = (props) => {
1937
1937
  onChange
1938
1938
  });
1939
1939
  };
1940
+ var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
1941
+ BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
1942
+ BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
1943
+ BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
1944
+ BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
1945
+ BRWOSER_PLATFORM2["H5"] = "H5";
1946
+ BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
1947
+ return BRWOSER_PLATFORM2;
1948
+ })(BRWOSER_PLATFORM || {});
1940
1949
  var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1941
1950
  OS_PLATFORM2["IOS"] = "IOS";
1942
1951
  OS_PLATFORM2["ANDROID"] = "ANDROID";
@@ -1949,6 +1958,18 @@ var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1949
1958
  WEBGL_STATUS2["ENABLED"] = "ENABLED";
1950
1959
  return WEBGL_STATUS2;
1951
1960
  })(WEBGL_STATUS || {});
1961
+ const detectBrowserPlatform = () => {
1962
+ if (typeof navigator === "undefined")
1963
+ return "NODE_JS";
1964
+ const useragent = navigator.userAgent.toLowerCase();
1965
+ if (useragent.includes("micromessenger")) {
1966
+ return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
1967
+ }
1968
+ if (useragent.includes("alipay")) {
1969
+ return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
1970
+ }
1971
+ return "H5";
1972
+ };
1952
1973
  const detectOSPlatform = () => {
1953
1974
  if (typeof navigator === "undefined")
1954
1975
  return "OTHER";
@@ -3510,6 +3531,9 @@ const useGeoLocation = (props) => {
3510
3531
  var _a, _b;
3511
3532
  const { onChange, onLoad, onLoadDefault, onError, geoDefaultPosition } = props != null ? props : {};
3512
3533
  const { toGcj02 } = useMapGCJ02();
3534
+ const isIOSAlipay = [BRWOSER_PLATFORM.ALIPAY, BRWOSER_PLATFORM.ALIPAY_MINIPROGRAM].includes(
3535
+ detectBrowserPlatform()
3536
+ ) && detectOSPlatform() === OS_PLATFORM.IOS;
3513
3537
  let isOnLoadTriggered = false;
3514
3538
  const loading = Vue.ref(false);
3515
3539
  const readyRef = Vue.ref(false);
@@ -3535,7 +3559,7 @@ const useGeoLocation = (props) => {
3535
3559
  spaceLog("watchPosition", "success duration, position = ", duration, position);
3536
3560
  const coordinate = position.coords;
3537
3561
  const wgsPoint = [position.coords.longitude, position.coords.latitude];
3538
- const point = await toGcj02(wgsPoint);
3562
+ const point = isIOSAlipay ? wgsPoint : await toGcj02(wgsPoint);
3539
3563
  coordinateRef.value = coordinate;
3540
3564
  positionRef.value = point;
3541
3565
  errorRef.value = void 0;
@@ -6987,9 +7011,6 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6987
7011
  });
6988
7012
  const carPositionRef = Vue.ref();
6989
7013
  const carAngleRef = Vue.ref();
6990
- const {
6991
- toGcj02
6992
- } = useMapGCJ02();
6993
7014
  Vue.watch(() => props.driverStatus, (status, _, onCleanup) => {
6994
7015
  if (!STATUS_NEED_CAR_POSITION.includes(status))
6995
7016
  return;
@@ -7000,7 +7021,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
7000
7021
  }) => {
7001
7022
  assertPoint(position);
7002
7023
  assertAngle(angle);
7003
- carPositionRef.value = position ? await toGcj02(position) : void 0;
7024
+ carPositionRef.value = position != null ? position : void 0;
7004
7025
  carAngleRef.value = angle;
7005
7026
  });
7006
7027
  };
package/dist/index.js CHANGED
@@ -1935,6 +1935,15 @@ const useMapLoader = (props) => {
1935
1935
  onChange
1936
1936
  });
1937
1937
  };
1938
+ var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
1939
+ BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
1940
+ BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
1941
+ BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
1942
+ BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
1943
+ BRWOSER_PLATFORM2["H5"] = "H5";
1944
+ BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
1945
+ return BRWOSER_PLATFORM2;
1946
+ })(BRWOSER_PLATFORM || {});
1938
1947
  var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1939
1948
  OS_PLATFORM2["IOS"] = "IOS";
1940
1949
  OS_PLATFORM2["ANDROID"] = "ANDROID";
@@ -1947,6 +1956,18 @@ var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1947
1956
  WEBGL_STATUS2["ENABLED"] = "ENABLED";
1948
1957
  return WEBGL_STATUS2;
1949
1958
  })(WEBGL_STATUS || {});
1959
+ const detectBrowserPlatform = () => {
1960
+ if (typeof navigator === "undefined")
1961
+ return "NODE_JS";
1962
+ const useragent = navigator.userAgent.toLowerCase();
1963
+ if (useragent.includes("micromessenger")) {
1964
+ return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
1965
+ }
1966
+ if (useragent.includes("alipay")) {
1967
+ return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
1968
+ }
1969
+ return "H5";
1970
+ };
1950
1971
  const detectOSPlatform = () => {
1951
1972
  if (typeof navigator === "undefined")
1952
1973
  return "OTHER";
@@ -3508,6 +3529,9 @@ const useGeoLocation = (props) => {
3508
3529
  var _a, _b;
3509
3530
  const { onChange, onLoad, onLoadDefault, onError, geoDefaultPosition } = props != null ? props : {};
3510
3531
  const { toGcj02 } = useMapGCJ02();
3532
+ const isIOSAlipay = [BRWOSER_PLATFORM.ALIPAY, BRWOSER_PLATFORM.ALIPAY_MINIPROGRAM].includes(
3533
+ detectBrowserPlatform()
3534
+ ) && detectOSPlatform() === OS_PLATFORM.IOS;
3511
3535
  let isOnLoadTriggered = false;
3512
3536
  const loading = ref(false);
3513
3537
  const readyRef = ref(false);
@@ -3533,7 +3557,7 @@ const useGeoLocation = (props) => {
3533
3557
  spaceLog("watchPosition", "success duration, position = ", duration, position);
3534
3558
  const coordinate = position.coords;
3535
3559
  const wgsPoint = [position.coords.longitude, position.coords.latitude];
3536
- const point = await toGcj02(wgsPoint);
3560
+ const point = isIOSAlipay ? wgsPoint : await toGcj02(wgsPoint);
3537
3561
  coordinateRef.value = coordinate;
3538
3562
  positionRef.value = point;
3539
3563
  errorRef.value = void 0;
@@ -6985,9 +7009,6 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6985
7009
  });
6986
7010
  const carPositionRef = ref();
6987
7011
  const carAngleRef = ref();
6988
- const {
6989
- toGcj02
6990
- } = useMapGCJ02();
6991
7012
  watch(() => props.driverStatus, (status, _, onCleanup) => {
6992
7013
  if (!STATUS_NEED_CAR_POSITION.includes(status))
6993
7014
  return;
@@ -6998,7 +7019,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6998
7019
  }) => {
6999
7020
  assertPoint(position);
7000
7021
  assertAngle(angle);
7001
- carPositionRef.value = position ? await toGcj02(position) : void 0;
7022
+ carPositionRef.value = position != null ? position : void 0;
7002
7023
  carAngleRef.value = angle;
7003
7024
  });
7004
7025
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.7.7-animate2",
3
+ "version": "0.7.8",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",