@heycar/heycars-map 0.7.7-animate1 → 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";
@@ -2120,7 +2141,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2120
2141
  (_a = mapRef.value) == null ? void 0 : _a.setStatus(statusOptions2);
2121
2142
  }
2122
2143
  );
2123
- Vue.watch(
2144
+ watchNoneImmediatePostEffectForDeepOption(
2124
2145
  () => props.center,
2125
2146
  (center, prevCenter) => {
2126
2147
  const map = mapRef.value;
@@ -2128,8 +2149,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2128
2149
  return;
2129
2150
  const immediately = prevCenter ? apiMapDistanceVwOfPoints(center, prevCenter) > MAX_ANIMATION_DISTANCE_VW : true;
2130
2151
  map.setCenter(center, immediately);
2131
- },
2132
- { immediate: false, flush: "post" }
2152
+ }
2133
2153
  );
2134
2154
  Vue.watch(
2135
2155
  () => props.zoom,
@@ -3511,6 +3531,9 @@ const useGeoLocation = (props) => {
3511
3531
  var _a, _b;
3512
3532
  const { onChange, onLoad, onLoadDefault, onError, geoDefaultPosition } = props != null ? props : {};
3513
3533
  const { toGcj02 } = useMapGCJ02();
3534
+ const isIOSAlipay = [BRWOSER_PLATFORM.ALIPAY, BRWOSER_PLATFORM.ALIPAY_MINIPROGRAM].includes(
3535
+ detectBrowserPlatform()
3536
+ ) && detectOSPlatform() === OS_PLATFORM.IOS;
3514
3537
  let isOnLoadTriggered = false;
3515
3538
  const loading = Vue.ref(false);
3516
3539
  const readyRef = Vue.ref(false);
@@ -3536,7 +3559,7 @@ const useGeoLocation = (props) => {
3536
3559
  spaceLog("watchPosition", "success duration, position = ", duration, position);
3537
3560
  const coordinate = position.coords;
3538
3561
  const wgsPoint = [position.coords.longitude, position.coords.latitude];
3539
- const point = await toGcj02(wgsPoint);
3562
+ const point = isIOSAlipay ? wgsPoint : await toGcj02(wgsPoint);
3540
3563
  coordinateRef.value = coordinate;
3541
3564
  positionRef.value = point;
3542
3565
  errorRef.value = void 0;
@@ -6988,9 +7011,6 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6988
7011
  });
6989
7012
  const carPositionRef = Vue.ref();
6990
7013
  const carAngleRef = Vue.ref();
6991
- const {
6992
- toGcj02
6993
- } = useMapGCJ02();
6994
7014
  Vue.watch(() => props.driverStatus, (status, _, onCleanup) => {
6995
7015
  if (!STATUS_NEED_CAR_POSITION.includes(status))
6996
7016
  return;
@@ -7001,7 +7021,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
7001
7021
  }) => {
7002
7022
  assertPoint(position);
7003
7023
  assertAngle(angle);
7004
- carPositionRef.value = position ? await toGcj02(position) : void 0;
7024
+ carPositionRef.value = position != null ? position : void 0;
7005
7025
  carAngleRef.value = angle;
7006
7026
  });
7007
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";
@@ -2118,7 +2139,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2118
2139
  (_a = mapRef.value) == null ? void 0 : _a.setStatus(statusOptions2);
2119
2140
  }
2120
2141
  );
2121
- watch(
2142
+ watchNoneImmediatePostEffectForDeepOption(
2122
2143
  () => props.center,
2123
2144
  (center, prevCenter) => {
2124
2145
  const map = mapRef.value;
@@ -2126,8 +2147,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
2126
2147
  return;
2127
2148
  const immediately = prevCenter ? apiMapDistanceVwOfPoints(center, prevCenter) > MAX_ANIMATION_DISTANCE_VW : true;
2128
2149
  map.setCenter(center, immediately);
2129
- },
2130
- { immediate: false, flush: "post" }
2150
+ }
2131
2151
  );
2132
2152
  watch(
2133
2153
  () => props.zoom,
@@ -3509,6 +3529,9 @@ const useGeoLocation = (props) => {
3509
3529
  var _a, _b;
3510
3530
  const { onChange, onLoad, onLoadDefault, onError, geoDefaultPosition } = props != null ? props : {};
3511
3531
  const { toGcj02 } = useMapGCJ02();
3532
+ const isIOSAlipay = [BRWOSER_PLATFORM.ALIPAY, BRWOSER_PLATFORM.ALIPAY_MINIPROGRAM].includes(
3533
+ detectBrowserPlatform()
3534
+ ) && detectOSPlatform() === OS_PLATFORM.IOS;
3512
3535
  let isOnLoadTriggered = false;
3513
3536
  const loading = ref(false);
3514
3537
  const readyRef = ref(false);
@@ -3534,7 +3557,7 @@ const useGeoLocation = (props) => {
3534
3557
  spaceLog("watchPosition", "success duration, position = ", duration, position);
3535
3558
  const coordinate = position.coords;
3536
3559
  const wgsPoint = [position.coords.longitude, position.coords.latitude];
3537
- const point = await toGcj02(wgsPoint);
3560
+ const point = isIOSAlipay ? wgsPoint : await toGcj02(wgsPoint);
3538
3561
  coordinateRef.value = coordinate;
3539
3562
  positionRef.value = point;
3540
3563
  errorRef.value = void 0;
@@ -6986,9 +7009,6 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6986
7009
  });
6987
7010
  const carPositionRef = ref();
6988
7011
  const carAngleRef = ref();
6989
- const {
6990
- toGcj02
6991
- } = useMapGCJ02();
6992
7012
  watch(() => props.driverStatus, (status, _, onCleanup) => {
6993
7013
  if (!STATUS_NEED_CAR_POSITION.includes(status))
6994
7014
  return;
@@ -6999,7 +7019,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
6999
7019
  }) => {
7000
7020
  assertPoint(position);
7001
7021
  assertAngle(angle);
7002
- carPositionRef.value = position ? await toGcj02(position) : void 0;
7022
+ carPositionRef.value = position != null ? position : void 0;
7003
7023
  carAngleRef.value = angle;
7004
7024
  });
7005
7025
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.7.7-animate1",
3
+ "version": "0.7.8",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite -c vite.config.dev.ts",