@heycar/heycars-map 2.7.1 → 2.7.2

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
@@ -4,8 +4,8 @@ import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
4
4
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
5
5
  const gmapApiKey = "AIzaSyCCOe8MAeS3EYvSraKsBX6ztVyLxj69z94";
6
6
  const gmapId = "d0af0c05331af64a";
7
- const amapApiKey = "81ed1d2b5b77187683717a5f2f19591a";
8
- const amapApiSecret = "1dfe626553258a9f91d7c4552c0816d2";
7
+ const amapApiKey = "fcb7b14c930354a248e21f4031dfa179";
8
+ const amapApiSecret = "11ad0e3d585b80d18b1ada5b0d947c4a";
9
9
  const App = defineComponent({
10
10
  setup() {
11
11
  const supplierRef = ref("amap");
@@ -1,10 +1,9 @@
1
1
  import type { SetMap } from "../../hooks/useHeycarMap";
2
2
  import type { AmapMap } from "../../types/interface";
3
3
  import type { MapEventHandler } from "../../types/mapHelper";
4
- import { type VectorMapForeign } from "../../utils/transform";
5
- export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
6
- vectorMapForeign?: VectorMapForeign;
4
+ export interface AmapProps extends Omit<AMap.MapOptions, "viewMode"> {
7
5
  mapRef?: SetMap<AmapMap>;
6
+ viewMode?: "2D" | "3D";
8
7
  dragEnable?: boolean;
9
8
  zoomEnable?: boolean;
10
9
  rotateEnable?: boolean;
@@ -14,15 +14,7 @@ import { SafeAmap } from "./SafeAmap.js";
14
14
  const Amap_css_ts_vanilla = "";
15
15
  var amap = "_1d8ur7t0";
16
16
  const Amap = defineSetup("Amap", function(props, { slots, emit, attrs }) {
17
- const {
18
- onDragStart,
19
- onDragEnd,
20
- onZoomEnd,
21
- onResize,
22
- mapRef: setMap,
23
- vectorMapForeign = "style_zh_cn",
24
- ...defaultOptions
25
- } = props;
17
+ const { onDragStart, onDragEnd, onZoomEnd, onResize, mapRef: setMap, ...defaultOptions } = props;
26
18
  const statusOptions = computed(() => {
27
19
  const {
28
20
  dragEnable = true,
@@ -65,8 +57,7 @@ const Amap = defineSetup("Amap", function(props, { slots, emit, attrs }) {
65
57
  const map = new SafeAmap(elementRef.value, {
66
58
  ...defaultOptions,
67
59
  scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
68
- doubleClickZoom: defaultOptions.touchZoomCenter ? false : defaultOptions.doubleClickZoom,
69
- vectorMapForeign
60
+ doubleClickZoom: defaultOptions.touchZoomCenter ? false : defaultOptions.doubleClickZoom
70
61
  });
71
62
  window.GlobalAmap = map;
72
63
  mapRef.value = map;
@@ -3,12 +3,23 @@ import { useAmap } from "../../hooks/useMap.js";
3
3
  import { useMapOverlay } from "../../hooks/useOverlay.js";
4
4
  import { defineSetup } from "../../types/helper.js";
5
5
  import { watchNoneImmediatePostEffectForMapProperty, watchPostEffectForAMapEvent } from "../../utils/compare.js";
6
+ import { detectTouchDevice } from "../../utils/platform.js";
6
7
  import { referenceCount } from "../../utils/referenceCount.js";
7
8
  import { useAmapFixBugOverlayDrag } from "../AmapPolygon/AmapPolygon.js";
9
+ const isTouchDevice = detectTouchDevice();
10
+ const shouldSkipByAmapClickDoubleTriggerBug = (e) => {
11
+ return isTouchDevice && e.originEvent.type === "mouseup";
12
+ };
8
13
  const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
9
14
  const { registerOverlay } = props;
10
15
  const markerRef = shallowRef();
11
16
  const mapRef = useAmap();
17
+ const emitClick = (_, e) => {
18
+ const event = e;
19
+ if (shouldSkipByAmapClickDoubleTriggerBug(event))
20
+ return;
21
+ emit("click", event);
22
+ };
12
23
  onMounted(() => {
13
24
  referenceCount.add();
14
25
  const { registerOverlay: registerOverlay2, onClick, ...option } = props;
@@ -49,7 +60,7 @@ const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
49
60
  { name: "title", defaultValue: "" },
50
61
  { name: "extData", defaultValue: "" }
51
62
  ]);
52
- watchPostEffectForAMapEvent(markerRef, props, emit, ["onClick"]);
63
+ watchPostEffectForAMapEvent(markerRef, props, emitClick, ["onClick"]);
53
64
  return () => null;
54
65
  });
55
66
  export {
@@ -8,7 +8,7 @@ import { defineLagecySetup } from "../../types/helper.js";
8
8
  import "../../utils/alipayPolyfill.js";
9
9
  import { loadTraditionalChineseConvertOnce } from "../../utils/cn2tw.js";
10
10
  import { detectWebGL, WEBGL_STATUS, detectBrowserPlatform, OS_PLATFORM, BRWOSER_PLATFORM, detectOSPlatform } from "../../utils/platform.js";
11
- import { language2vectorMapForeign, vec2lnglat } from "../../utils/transform.js";
11
+ import { vec2lnglat } from "../../utils/transform.js";
12
12
  import { Amap } from "../Amap/Amap.js";
13
13
  import { Gmap } from "../Gmap/Gmap.js";
14
14
  import { t as throttle } from "../../chunks/throttle.8bdd8d3b.js";
@@ -162,7 +162,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
162
162
  }, [h(Amap, {
163
163
  "attrs": {
164
164
  "mapRef": setMap,
165
- "vectorMapForeign": language2vectorMapForeign(language),
165
+ "showOversea": true,
166
166
  "center": center,
167
167
  "zoom": zoom,
168
168
  "dragEnable": touchEnable,
@@ -3,6 +3,7 @@ export type * from "./driving";
3
3
  export type * from "./geocoder";
4
4
  export type * from "./graspRoad";
5
5
  export type * from "./marker";
6
+ export type * from "./options";
6
7
  export type * from "./place";
7
8
  export type * from "./plugin";
8
9
  export type * from "./walking";
@@ -0,0 +1,8 @@
1
+ export {};
2
+ declare global {
3
+ namespace AMap {
4
+ interface MapOptions {
5
+ showOversea?: boolean;
6
+ }
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.7.1";
3
+ const pkgVersion = "2.7.2";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -28,3 +28,4 @@ export declare const detectOSPlatform: () => OS_PLATFORM;
28
28
  * Inspired from http://www.browserleaks.com/webgl#howto-detect-webgl
29
29
  */
30
30
  export declare function detectWebGL(): WEBGL_STATUS;
31
+ export declare function detectTouchDevice(): boolean;
@@ -80,6 +80,9 @@ function detectWebGL() {
80
80
  }
81
81
  return "NOT_SUPPORTED";
82
82
  }
83
+ function detectTouchDevice() {
84
+ return "ontouchend" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
85
+ }
83
86
  export {
84
87
  ALIPAY_WALLET,
85
88
  BRWOSER_PLATFORM,
@@ -88,5 +91,6 @@ export {
88
91
  detectAlipayWallet,
89
92
  detectBrowserPlatform,
90
93
  detectOSPlatform,
94
+ detectTouchDevice,
91
95
  detectWebGL
92
96
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { Language, LngLatLiterial, Place, Point, TrackPoint, Zone } from "../types/interface";
2
+ import type { LngLatLiterial, Place, Point, TrackPoint, Zone } from "../types/interface";
3
3
  import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
4
4
  import type { WxGetLocationSuccessResponse } from "../types/wx";
5
5
  import { BRWOSER_PLATFORM } from "./platform";
@@ -18,8 +18,6 @@ export interface AsteriskItem {
18
18
  export declare const decodeAsterisk: (encodedValue: string) => AsteriskItem[];
19
19
  export declare const property2emitEventName: (propertyName: string) => string;
20
20
  export declare const property2mapEventName: (propertyName: string) => string;
21
- export type VectorMapForeign = "style_en" | "style_local" | "style_zh_cn";
22
- export declare const language2vectorMapForeign: (lang: Language) => VectorMapForeign;
23
21
  export declare const place2point: (place: Place) => Point;
24
22
  export declare const combineHandler: <P extends any[], R>(fn1: ((...args: P) => any) | undefined, fn2: (...args: P) => R) => (...args: P) => R;
25
23
  export declare const pipeAsync: <P extends any[]>(fn?: ((...args: P) => any) | undefined) => (...args: P) => void;
@@ -61,15 +61,6 @@ const property2emitEventName = (propertyName) => {
61
61
  const property2mapEventName = (propertyName) => {
62
62
  return propertyName.slice(2).toLowerCase();
63
63
  };
64
- const language2vectorMapForeign = (lang) => {
65
- switch (lang) {
66
- case "en":
67
- return "style_en";
68
- case "zh-TW":
69
- case "zh":
70
- return "style_zh_cn";
71
- }
72
- };
73
64
  const place2point = (place) => [Number(place.lng), Number(place.lat)];
74
65
  const combineHandler = (fn1, fn2) => {
75
66
  return (...args) => {
@@ -316,7 +307,6 @@ export {
316
307
  isPlaceEqual,
317
308
  isPointEqual,
318
309
  isZoneEqual,
319
- language2vectorMapForeign,
320
310
  lnglat2point,
321
311
  maybeFunctionToFunction,
322
312
  pipeAsync,
package/dist/v3/App.js CHANGED
@@ -4,8 +4,8 @@ import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
4
4
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
5
5
  const gmapApiKey = "AIzaSyCCOe8MAeS3EYvSraKsBX6ztVyLxj69z94";
6
6
  const gmapId = "d0af0c05331af64a";
7
- const amapApiKey = "81ed1d2b5b77187683717a5f2f19591a";
8
- const amapApiSecret = "1dfe626553258a9f91d7c4552c0816d2";
7
+ const amapApiKey = "fcb7b14c930354a248e21f4031dfa179";
8
+ const amapApiSecret = "11ad0e3d585b80d18b1ada5b0d947c4a";
9
9
  const App = /* @__PURE__ */ defineComponent({
10
10
  setup() {
11
11
  const supplierRef = ref("amap");
@@ -1,11 +1,10 @@
1
1
  import type { SetMap } from "../../hooks/useHeycarMap";
2
2
  import type { AmapMap } from "../../types/interface";
3
3
  import type { MapEventHandler } from "../../types/mapHelper";
4
- import { type VectorMapForeign } from "../../utils/transform";
5
4
  import { SafeAmap } from "./SafeAmap";
6
- export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
7
- vectorMapForeign?: VectorMapForeign;
5
+ export interface AmapProps extends Omit<AMap.MapOptions, "viewMode"> {
8
6
  mapRef?: SetMap<AmapMap>;
7
+ viewMode?: "2D" | "3D";
9
8
  dragEnable?: boolean;
10
9
  zoomEnable?: boolean;
11
10
  rotateEnable?: boolean;
@@ -14,15 +14,7 @@ import { SafeAmap } from "./SafeAmap.js";
14
14
  const Amap_css_ts_vanilla = "";
15
15
  var amap = "_1d8ur7t0";
16
16
  const Amap = defineSetup("Amap", function(props, { slots, emit, attrs }) {
17
- const {
18
- onDragStart,
19
- onDragEnd,
20
- onZoomEnd,
21
- onResize,
22
- mapRef: setMap,
23
- vectorMapForeign = "style_zh_cn",
24
- ...defaultOptions
25
- } = props;
17
+ const { onDragStart, onDragEnd, onZoomEnd, onResize, mapRef: setMap, ...defaultOptions } = props;
26
18
  const statusOptions = computed(() => {
27
19
  const {
28
20
  dragEnable = true,
@@ -65,8 +57,7 @@ const Amap = defineSetup("Amap", function(props, { slots, emit, attrs }) {
65
57
  const map = new SafeAmap(elementRef.value, {
66
58
  ...defaultOptions,
67
59
  scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
68
- doubleClickZoom: defaultOptions.touchZoomCenter ? false : defaultOptions.doubleClickZoom,
69
- vectorMapForeign
60
+ doubleClickZoom: defaultOptions.touchZoomCenter ? false : defaultOptions.doubleClickZoom
70
61
  });
71
62
  window.GlobalAmap = map;
72
63
  mapRef.value = map;
@@ -3,12 +3,23 @@ import { useAmap } from "../../hooks/useMap.js";
3
3
  import { useMapOverlay } from "../../hooks/useOverlay.js";
4
4
  import { defineSetup } from "../../types/helper.js";
5
5
  import { watchNoneImmediatePostEffectForMapProperty, watchPostEffectForAMapEvent } from "../../utils/compare.js";
6
+ import { detectTouchDevice } from "../../utils/platform.js";
6
7
  import { referenceCount } from "../../utils/referenceCount.js";
7
8
  import { useAmapFixBugOverlayDrag } from "../AmapPolygon/AmapPolygon.js";
9
+ const isTouchDevice = detectTouchDevice();
10
+ const shouldSkipByAmapClickDoubleTriggerBug = (e) => {
11
+ return isTouchDevice && e.originEvent.type === "mouseup";
12
+ };
8
13
  const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
9
14
  const { registerOverlay } = props;
10
15
  const markerRef = shallowRef();
11
16
  const mapRef = useAmap();
17
+ const emitClick = (_, e) => {
18
+ const event = e;
19
+ if (shouldSkipByAmapClickDoubleTriggerBug(event))
20
+ return;
21
+ emit("click", event);
22
+ };
12
23
  onMounted(() => {
13
24
  referenceCount.add();
14
25
  const { registerOverlay: registerOverlay2, onClick, ...option } = props;
@@ -49,7 +60,7 @@ const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
49
60
  { name: "title", defaultValue: "" },
50
61
  { name: "extData", defaultValue: "" }
51
62
  ]);
52
- watchPostEffectForAMapEvent(markerRef, props, emit, ["onClick"]);
63
+ watchPostEffectForAMapEvent(markerRef, props, emitClick, ["onClick"]);
53
64
  return () => null;
54
65
  });
55
66
  export {
@@ -8,7 +8,7 @@ import { defineLagecySetup } from "../../types/helper.js";
8
8
  import "../../utils/alipayPolyfill.js";
9
9
  import { loadTraditionalChineseConvertOnce } from "../../utils/cn2tw.js";
10
10
  import { detectWebGL, WEBGL_STATUS, detectBrowserPlatform, OS_PLATFORM, BRWOSER_PLATFORM, detectOSPlatform } from "../../utils/platform.js";
11
- import { language2vectorMapForeign, vec2lnglat } from "../../utils/transform.js";
11
+ import { vec2lnglat } from "../../utils/transform.js";
12
12
  import { Amap } from "../Amap/Amap.js";
13
13
  import { Gmap } from "../Gmap/Gmap.js";
14
14
  import { t as throttle } from "../../chunks/throttle.8bdd8d3b.js";
@@ -154,7 +154,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
154
154
  "style": attrs.style
155
155
  }, [createVNode(Amap, {
156
156
  "mapRef": setMap,
157
- "vectorMapForeign": language2vectorMapForeign(language),
157
+ "showOversea": true,
158
158
  "center": center,
159
159
  "zoom": zoom,
160
160
  "dragEnable": touchEnable,
@@ -3,6 +3,7 @@ export type * from "./driving";
3
3
  export type * from "./geocoder";
4
4
  export type * from "./graspRoad";
5
5
  export type * from "./marker";
6
+ export type * from "./options";
6
7
  export type * from "./place";
7
8
  export type * from "./plugin";
8
9
  export type * from "./walking";
@@ -0,0 +1,8 @@
1
+ export {};
2
+ declare global {
3
+ namespace AMap {
4
+ interface MapOptions {
5
+ showOversea?: boolean;
6
+ }
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.7.1";
3
+ const pkgVersion = "2.7.2";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -28,3 +28,4 @@ export declare const detectOSPlatform: () => OS_PLATFORM;
28
28
  * Inspired from http://www.browserleaks.com/webgl#howto-detect-webgl
29
29
  */
30
30
  export declare function detectWebGL(): WEBGL_STATUS;
31
+ export declare function detectTouchDevice(): boolean;
@@ -80,6 +80,9 @@ function detectWebGL() {
80
80
  }
81
81
  return "NOT_SUPPORTED";
82
82
  }
83
+ function detectTouchDevice() {
84
+ return "ontouchend" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
85
+ }
83
86
  export {
84
87
  ALIPAY_WALLET,
85
88
  BRWOSER_PLATFORM,
@@ -88,5 +91,6 @@ export {
88
91
  detectAlipayWallet,
89
92
  detectBrowserPlatform,
90
93
  detectOSPlatform,
94
+ detectTouchDevice,
91
95
  detectWebGL
92
96
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { Language, LngLatLiterial, Place, Point, TrackPoint, Zone } from "../types/interface";
2
+ import type { LngLatLiterial, Place, Point, TrackPoint, Zone } from "../types/interface";
3
3
  import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
4
4
  import type { WxGetLocationSuccessResponse } from "../types/wx";
5
5
  import { BRWOSER_PLATFORM } from "./platform";
@@ -18,8 +18,6 @@ export interface AsteriskItem {
18
18
  export declare const decodeAsterisk: (encodedValue: string) => AsteriskItem[];
19
19
  export declare const property2emitEventName: (propertyName: string) => string;
20
20
  export declare const property2mapEventName: (propertyName: string) => string;
21
- export type VectorMapForeign = "style_en" | "style_local" | "style_zh_cn";
22
- export declare const language2vectorMapForeign: (lang: Language) => VectorMapForeign;
23
21
  export declare const place2point: (place: Place) => Point;
24
22
  export declare const combineHandler: <P extends any[], R>(fn1: ((...args: P) => any) | undefined, fn2: (...args: P) => R) => (...args: P) => R;
25
23
  export declare const pipeAsync: <P extends any[]>(fn?: ((...args: P) => any) | undefined) => (...args: P) => void;
@@ -61,15 +61,6 @@ const property2emitEventName = (propertyName) => {
61
61
  const property2mapEventName = (propertyName) => {
62
62
  return propertyName.slice(2).toLowerCase();
63
63
  };
64
- const language2vectorMapForeign = (lang) => {
65
- switch (lang) {
66
- case "en":
67
- return "style_en";
68
- case "zh-TW":
69
- case "zh":
70
- return "style_zh_cn";
71
- }
72
- };
73
64
  const place2point = (place) => [Number(place.lng), Number(place.lat)];
74
65
  const combineHandler = (fn1, fn2) => {
75
66
  return (...args) => {
@@ -316,7 +307,6 @@ export {
316
307
  isPlaceEqual,
317
308
  isPointEqual,
318
309
  isZoneEqual,
319
- language2vectorMapForeign,
320
310
  lnglat2point,
321
311
  maybeFunctionToFunction,
322
312
  pipeAsync,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",