@heycar/heycars-map 2.21.0-gmapCost6 → 2.21.0-gmapCost7

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/v2/App.js CHANGED
@@ -8,7 +8,7 @@ const amapApiKey = "fcb7b14c930354a248e21f4031dfa179";
8
8
  const amapApiSecret = "11ad0e3d585b80d18b1ada5b0d947c4a";
9
9
  const App = defineComponent({
10
10
  setup() {
11
- const supplierRef = ref("gmap");
11
+ const supplierRef = ref("amap");
12
12
  window.supplierRef = supplierRef;
13
13
  return () => h(MapProvider, {
14
14
  "attrs": {
@@ -16,7 +16,7 @@ const App = defineComponent({
16
16
  "amapSecret": amapApiSecret,
17
17
  "gmapId": gmapId,
18
18
  "gmapKey": gmapApiKey,
19
- "language": "en",
19
+ "language": "zh",
20
20
  "supplier": supplierRef.value,
21
21
  "gaodeRegeoProxyUrl": "/overseas/amap/regeo",
22
22
  "googleRegeoProxyUrl": "/overseas/maps/regeo",
@@ -53,8 +53,9 @@ class SafeAmap {
53
53
  return (_a = this.amap) == null ? void 0 : _a.getBounds();
54
54
  }
55
55
  getCenter() {
56
- var _a;
57
- return (_a = this.amap) == null ? void 0 : _a.getCenter();
56
+ var _a, _b;
57
+ console.log("===高德地图Amap.getCenter", (_a = this.amap) == null ? void 0 : _a.getCenter());
58
+ return (_b = this.amap) == null ? void 0 : _b.getCenter();
58
59
  }
59
60
  getGraphicInfo() {
60
61
  var _a;
@@ -38,7 +38,7 @@ const useAmapGCJ02 = () => {
38
38
  const coordinateType = toCoordinateType(point);
39
39
  if (coordinateType === "gcj02")
40
40
  return exported.transform(point, exported.GCJ02, exported.WGS84);
41
- return exported.transform(point, exported.WGS84, exported.GCJ02);
41
+ return point;
42
42
  } catch (err) {
43
43
  const error = err;
44
44
  console.error(`本地转换GCJ02失败: ${error.message}
@@ -84,7 +84,7 @@ const useGmapGCJ02 = () => {
84
84
  return point;
85
85
  const coordinateType = toCoordinateType(point);
86
86
  if (coordinateType === "gcj02")
87
- return exported.transform(point, exported.GCJ02, exported.WGS84);
87
+ return point;
88
88
  return exported.transform(point, exported.WGS84, exported.GCJ02);
89
89
  } catch (err) {
90
90
  const error = err;
@@ -5,7 +5,7 @@ import { PointSource } from "../types/interface.js";
5
5
  import { createPipeTw } from "../utils/cn2tw.js";
6
6
  import { equalAssign, AbortSignalAny, sleep } from "../utils/helper.js";
7
7
  import { getHKGovernResult } from "../utils/hongkongGovernGeoCoder.js";
8
- import { amapPlaceName2DisplayName, signal2promise, toLocalWgs84Force, gmapPlaceName2DisplayName } from "../utils/transform.js";
8
+ import { amapPlaceName2DisplayName, signal2promise, gmapPlaceName2DisplayName } from "../utils/transform.js";
9
9
  import { inHongkong, inChina, inTaiwan } from "./useMapInChina.js";
10
10
  import { useMapSupplier } from "./useMapSupplier.js";
11
11
  import { useUpdate } from "./useUdate.js";
@@ -16,6 +16,7 @@ const useAmapPlace = (props) => {
16
16
  const { signal: inputSignal, onChange, emptyPlaceName } = props;
17
17
  const defaultPoint = [...props.pointRef.value];
18
18
  const pointRef = ref(defaultPoint);
19
+ const { toCrossMapPoint } = useMapGCJ02();
19
20
  const { readyPromise, language, hkGovernRegeoProxyUrl, gaodeRegeoProxyUrl } = useMapSupplier();
20
21
  const place = reactive({
21
22
  lng: pointRef.value[0],
@@ -45,7 +46,11 @@ const useAmapPlace = (props) => {
45
46
  };
46
47
  const isUseHKGovern = inHongkong([lng, lat]) && hkGovernRegeoProxyUrl;
47
48
  if (isUseHKGovern) {
48
- return getPlaceByGmapRegeo([lng, lat], opt).then((res) => resolve(res));
49
+ const [finalLng, finalLat] = toCrossMapPoint([lng, lat]);
50
+ console.log("lng:", lng, finalLng, "lat:", lat, finalLat);
51
+ return getPlaceByGmapRegeo([finalLng, finalLat], opt).then(
52
+ (res) => resolve({ ...res, lat, lng })
53
+ );
49
54
  }
50
55
  readyPromise.then(() => {
51
56
  const pipeTw = createPipeTw(language === "zh-TW");
@@ -127,7 +132,6 @@ const useGmapPlace = (props) => {
127
132
  const defaultPoint = [...props.pointRef.value];
128
133
  const pointRef = ref(defaultPoint);
129
134
  const { readyPromise, language, googleRegeoProxyUrl, hkGovernRegeoProxyUrl } = useMapSupplier();
130
- const { toCoordinateType } = useMapGCJ02();
131
135
  const { idx: placeKey, update } = useUpdate();
132
136
  const place = reactive({
133
137
  lng: pointRef.value[0],
@@ -162,12 +166,10 @@ const useGmapPlace = (props) => {
162
166
  let hkReturned = false;
163
167
  let mapReturned = false;
164
168
  if (isUseHKGovern) {
165
- const [finalLng, finalLat] = toLocalWgs84Force([lng, lat], toCoordinateType([lng, lat]));
166
- console.log("lng:", lng, finalLng, "lat:", lat, finalLat);
167
169
  apiHongKongGovernDriving({
168
170
  proxyUrl: hkGovernRegeoProxyUrl,
169
- lng: finalLng,
170
- lat: finalLat,
171
+ lng,
172
+ lat,
171
173
  language: language === "zh-TW" ? "zh" : language
172
174
  }).then(({ result, origin }) => {
173
175
  var _a2, _b;
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.21.0-gmapCost6";
3
+ const pkgVersion = "2.21.0-gmapCost7";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
package/dist/v3/App.js CHANGED
@@ -8,14 +8,14 @@ const amapApiKey = "fcb7b14c930354a248e21f4031dfa179";
8
8
  const amapApiSecret = "11ad0e3d585b80d18b1ada5b0d947c4a";
9
9
  const App = /* @__PURE__ */ defineComponent({
10
10
  setup() {
11
- const supplierRef = ref("gmap");
11
+ const supplierRef = ref("amap");
12
12
  window.supplierRef = supplierRef;
13
13
  return () => createVNode(MapProvider, {
14
14
  "amapKey": amapApiKey,
15
15
  "amapSecret": amapApiSecret,
16
16
  "gmapId": gmapId,
17
17
  "gmapKey": gmapApiKey,
18
- "language": "en",
18
+ "language": "zh",
19
19
  "supplier": supplierRef.value,
20
20
  "gaodeRegeoProxyUrl": "/overseas/amap/regeo",
21
21
  "googleRegeoProxyUrl": "/overseas/maps/regeo",
@@ -53,8 +53,9 @@ class SafeAmap {
53
53
  return (_a = this.amap) == null ? void 0 : _a.getBounds();
54
54
  }
55
55
  getCenter() {
56
- var _a;
57
- return (_a = this.amap) == null ? void 0 : _a.getCenter();
56
+ var _a, _b;
57
+ console.log("===高德地图Amap.getCenter", (_a = this.amap) == null ? void 0 : _a.getCenter());
58
+ return (_b = this.amap) == null ? void 0 : _b.getCenter();
58
59
  }
59
60
  getGraphicInfo() {
60
61
  var _a;
@@ -38,7 +38,7 @@ const useAmapGCJ02 = () => {
38
38
  const coordinateType = toCoordinateType(point);
39
39
  if (coordinateType === "gcj02")
40
40
  return exported.transform(point, exported.GCJ02, exported.WGS84);
41
- return exported.transform(point, exported.WGS84, exported.GCJ02);
41
+ return point;
42
42
  } catch (err) {
43
43
  const error = err;
44
44
  console.error(`本地转换GCJ02失败: ${error.message}
@@ -84,7 +84,7 @@ const useGmapGCJ02 = () => {
84
84
  return point;
85
85
  const coordinateType = toCoordinateType(point);
86
86
  if (coordinateType === "gcj02")
87
- return exported.transform(point, exported.GCJ02, exported.WGS84);
87
+ return point;
88
88
  return exported.transform(point, exported.WGS84, exported.GCJ02);
89
89
  } catch (err) {
90
90
  const error = err;
@@ -5,7 +5,7 @@ import { PointSource } from "../types/interface.js";
5
5
  import { createPipeTw } from "../utils/cn2tw.js";
6
6
  import { equalAssign, AbortSignalAny, sleep } from "../utils/helper.js";
7
7
  import { getHKGovernResult } from "../utils/hongkongGovernGeoCoder.js";
8
- import { amapPlaceName2DisplayName, signal2promise, toLocalWgs84Force, gmapPlaceName2DisplayName } from "../utils/transform.js";
8
+ import { amapPlaceName2DisplayName, signal2promise, gmapPlaceName2DisplayName } from "../utils/transform.js";
9
9
  import { inHongkong, inChina, inTaiwan } from "./useMapInChina.js";
10
10
  import { useMapSupplier } from "./useMapSupplier.js";
11
11
  import { useUpdate } from "./useUdate.js";
@@ -16,6 +16,7 @@ const useAmapPlace = (props) => {
16
16
  const { signal: inputSignal, onChange, emptyPlaceName } = props;
17
17
  const defaultPoint = [...props.pointRef.value];
18
18
  const pointRef = ref(defaultPoint);
19
+ const { toCrossMapPoint } = useMapGCJ02();
19
20
  const { readyPromise, language, hkGovernRegeoProxyUrl, gaodeRegeoProxyUrl } = useMapSupplier();
20
21
  const place = reactive({
21
22
  lng: pointRef.value[0],
@@ -45,7 +46,11 @@ const useAmapPlace = (props) => {
45
46
  };
46
47
  const isUseHKGovern = inHongkong([lng, lat]) && hkGovernRegeoProxyUrl;
47
48
  if (isUseHKGovern) {
48
- return getPlaceByGmapRegeo([lng, lat], opt).then((res) => resolve(res));
49
+ const [finalLng, finalLat] = toCrossMapPoint([lng, lat]);
50
+ console.log("lng:", lng, finalLng, "lat:", lat, finalLat);
51
+ return getPlaceByGmapRegeo([finalLng, finalLat], opt).then(
52
+ (res) => resolve({ ...res, lat, lng })
53
+ );
49
54
  }
50
55
  readyPromise.then(() => {
51
56
  const pipeTw = createPipeTw(language === "zh-TW");
@@ -127,7 +132,6 @@ const useGmapPlace = (props) => {
127
132
  const defaultPoint = [...props.pointRef.value];
128
133
  const pointRef = ref(defaultPoint);
129
134
  const { readyPromise, language, googleRegeoProxyUrl, hkGovernRegeoProxyUrl } = useMapSupplier();
130
- const { toCoordinateType } = useMapGCJ02();
131
135
  const { idx: placeKey, update } = useUpdate();
132
136
  const place = reactive({
133
137
  lng: pointRef.value[0],
@@ -162,12 +166,10 @@ const useGmapPlace = (props) => {
162
166
  let hkReturned = false;
163
167
  let mapReturned = false;
164
168
  if (isUseHKGovern) {
165
- const [finalLng, finalLat] = toLocalWgs84Force([lng, lat], toCoordinateType([lng, lat]));
166
- console.log("lng:", lng, finalLng, "lat:", lat, finalLat);
167
169
  apiHongKongGovernDriving({
168
170
  proxyUrl: hkGovernRegeoProxyUrl,
169
- lng: finalLng,
170
- lat: finalLat,
171
+ lng,
172
+ lat,
171
173
  language: language === "zh-TW" ? "zh" : language
172
174
  }).then(({ result, origin }) => {
173
175
  var _a2, _b;
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.21.0-gmapCost6";
3
+ const pkgVersion = "2.21.0-gmapCost7";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.21.0-gmapCost6",
3
+ "version": "2.21.0-gmapCost7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",