@heycar/heycars-map 0.7.6 → 0.7.7-animate2
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/api/contants.d.ts +1 -0
- package/dist/hooks/useHeycarMap.d.ts +2 -2
- package/dist/hooks/useMapLngLatToVw.d.ts +14 -5
- package/dist/index.cjs +150 -115
- package/dist/index.js +150 -115
- package/package.json +1 -1
package/dist/api/contants.d.ts
CHANGED
|
@@ -398,7 +398,7 @@ export declare const useHeycarAmap: () => {
|
|
|
398
398
|
getEvents(): Record<string, any[]>;
|
|
399
399
|
} | undefined>;
|
|
400
400
|
mapElementRef: import("vue-demi").ShallowRef<HTMLElement | undefined>;
|
|
401
|
-
panTo: (value: [number, number]) => void
|
|
401
|
+
panTo: (value: [number, number]) => Promise<void>;
|
|
402
402
|
setMap: SetMap<{
|
|
403
403
|
_outseaDataType: string;
|
|
404
404
|
setCenter(center: [number, number] | AMap.LngLat, immediately?: boolean | undefined, duration?: number | undefined): void;
|
|
@@ -1200,7 +1200,7 @@ export declare const useHeycarMap: () => {
|
|
|
1200
1200
|
getEvents(): Record<string, any[]>;
|
|
1201
1201
|
} | undefined>;
|
|
1202
1202
|
mapElementRef: import("vue-demi").ShallowRef<HTMLElement | undefined>;
|
|
1203
|
-
panTo: (value: [number, number]) => void
|
|
1203
|
+
panTo: (value: [number, number]) => Promise<void>;
|
|
1204
1204
|
setMap: SetMap<{
|
|
1205
1205
|
_outseaDataType: string;
|
|
1206
1206
|
setCenter(center: [number, number] | AMap.LngLat, immediately?: boolean | undefined, duration?: number | undefined): void;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import type { ShallowRef } from "vue-demi";
|
|
1
3
|
import type { Point } from "../types/interface";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
interface UseMapLngLatToVwProps<M> {
|
|
5
|
+
mapRef: ShallowRef<M | undefined>;
|
|
6
|
+
}
|
|
7
|
+
export declare const useAmapLngLatToVw: (props: UseMapLngLatToVwProps<AMap.Map>) => {
|
|
8
|
+
apiMapLngLatToVw: (point: Point) => number[];
|
|
9
|
+
apiMapDistanceVwOfPoints: (point1: Point, point2: Point) => number;
|
|
4
10
|
};
|
|
5
|
-
export declare const useGmapLngLatToVw: () => {
|
|
11
|
+
export declare const useGmapLngLatToVw: (props: UseMapLngLatToVwProps<google.maps.Map>) => {
|
|
6
12
|
apiMapLngLatToVw: (point: Point) => [number, number];
|
|
13
|
+
apiMapDistanceVwOfPoints: (point1: Point, point2: Point) => number;
|
|
7
14
|
};
|
|
8
|
-
export declare const useMapLngLatToVw: () => {
|
|
9
|
-
apiMapLngLatToVw: (point: Point) => [
|
|
15
|
+
export declare const useMapLngLatToVw: (props: UseMapLngLatToVwProps<AMap.Map | google.maps.Map>) => {
|
|
16
|
+
apiMapLngLatToVw: (point: Point) => number[];
|
|
17
|
+
apiMapDistanceVwOfPoints: (point1: Point, point2: Point) => number;
|
|
10
18
|
};
|
|
19
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1983,6 +1983,54 @@ function detectWebGL() {
|
|
|
1983
1983
|
}
|
|
1984
1984
|
return "NOT_SUPPORTED";
|
|
1985
1985
|
}
|
|
1986
|
+
const MAX_ANIMATION_DISTANCE_VW = 100;
|
|
1987
|
+
const BEIJIN_POINT = [116.2317, 39.5427];
|
|
1988
|
+
const ZINDEX_BUBBLE_LAYER = 50;
|
|
1989
|
+
const ZINDEX_START_END_LOGO_LAYER = 40;
|
|
1990
|
+
const ZINDEX_PLACE_LAYER = 30;
|
|
1991
|
+
const ZINDEX_CAR_LAYER = 21;
|
|
1992
|
+
const ZINDEX_PASSENGER_LAYER = 20;
|
|
1993
|
+
const useAmapLngLatToVw = (props) => {
|
|
1994
|
+
const apiMapLngLatToVw = (point) => {
|
|
1995
|
+
const amap2 = props.mapRef.value;
|
|
1996
|
+
const sw = innerWidth;
|
|
1997
|
+
const [x, y] = amap2 == null ? void 0 : amap2.lngLatToContainer(point).toArray();
|
|
1998
|
+
return [100 * x / sw, 100 * y / sw];
|
|
1999
|
+
};
|
|
2000
|
+
const apiMapDistanceVwOfPoints = (point1, point2) => {
|
|
2001
|
+
const [x1, y1] = apiMapLngLatToVw(point1);
|
|
2002
|
+
const [x2, y2] = apiMapLngLatToVw(point2);
|
|
2003
|
+
const result = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
|
2004
|
+
console.log("distance = ", result);
|
|
2005
|
+
return result;
|
|
2006
|
+
};
|
|
2007
|
+
return { apiMapLngLatToVw, apiMapDistanceVwOfPoints };
|
|
2008
|
+
};
|
|
2009
|
+
const useGmapLngLatToVw = (props) => {
|
|
2010
|
+
const apiMapLngLatToVw = (point) => {
|
|
2011
|
+
var _a, _b, _c;
|
|
2012
|
+
const [lng, lat] = point;
|
|
2013
|
+
const gmap2 = props.mapRef.value;
|
|
2014
|
+
const sw = window.innerWidth;
|
|
2015
|
+
const projection = gmap2 == null ? void 0 : gmap2.getProjection();
|
|
2016
|
+
const worldCoordinate = projection == null ? void 0 : projection.fromLatLngToPoint({ lng, lat });
|
|
2017
|
+
const x = (_a = worldCoordinate == null ? void 0 : worldCoordinate.x) != null ? _a : 0;
|
|
2018
|
+
const y = (_b = worldCoordinate == null ? void 0 : worldCoordinate.y) != null ? _b : 0;
|
|
2019
|
+
const zoom = (_c = gmap2 == null ? void 0 : gmap2.getZoom()) != null ? _c : 0;
|
|
2020
|
+
const scale = 2 ** zoom;
|
|
2021
|
+
return [100 * x * scale / sw, 100 * y * scale / sw];
|
|
2022
|
+
};
|
|
2023
|
+
const apiMapDistanceVwOfPoints = (point1, point2) => {
|
|
2024
|
+
const [x1, y1] = apiMapLngLatToVw(point1);
|
|
2025
|
+
const [x2, y2] = apiMapLngLatToVw(point2);
|
|
2026
|
+
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
|
2027
|
+
};
|
|
2028
|
+
return { apiMapLngLatToVw, apiMapDistanceVwOfPoints };
|
|
2029
|
+
};
|
|
2030
|
+
const useMapLngLatToVw = (props) => {
|
|
2031
|
+
const { supplier } = useMapSupplier();
|
|
2032
|
+
return supplier === "gmap" ? useGmapLngLatToVw(props) : useAmapLngLatToVw(props);
|
|
2033
|
+
};
|
|
1986
2034
|
const ZOOM_WHEEL_RATIO = -135e-5;
|
|
1987
2035
|
const useAmapWheelZoomCenter = (props) => {
|
|
1988
2036
|
const { mapRef, enableRef } = props;
|
|
@@ -1991,7 +2039,7 @@ const useAmapWheelZoomCenter = (props) => {
|
|
|
1991
2039
|
const { deltaY } = e;
|
|
1992
2040
|
const prevZoom = (_b = (_a = mapRef.value) == null ? void 0 : _a.getZoom()) != null ? _b : 0;
|
|
1993
2041
|
const zoom = prevZoom + ZOOM_WHEEL_RATIO * deltaY;
|
|
1994
|
-
(_c = mapRef.value) == null ? void 0 : _c.setZoom(zoom);
|
|
2042
|
+
(_c = mapRef.value) == null ? void 0 : _c.setZoom(zoom, true);
|
|
1995
2043
|
};
|
|
1996
2044
|
Vue.watch(
|
|
1997
2045
|
() => enableRef == null ? void 0 : enableRef.value,
|
|
@@ -2051,6 +2099,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
2051
2099
|
const elementRef = Vue.shallowRef();
|
|
2052
2100
|
const mapRef = Vue.shallowRef();
|
|
2053
2101
|
provideAmap(mapRef);
|
|
2102
|
+
const { apiMapDistanceVwOfPoints } = useMapLngLatToVw({ mapRef });
|
|
2054
2103
|
useAmapWheelZoomCenter({ mapRef, enableRef: Vue.computed(() => !!props.touchZoomCenter) });
|
|
2055
2104
|
Vue.watchPostEffect(() => {
|
|
2056
2105
|
if (mapRef.value || !elementRef.value)
|
|
@@ -2071,10 +2120,28 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
2071
2120
|
(_a = mapRef.value) == null ? void 0 : _a.setStatus(statusOptions2);
|
|
2072
2121
|
}
|
|
2073
2122
|
);
|
|
2123
|
+
watchNoneImmediatePostEffectForDeepOption(
|
|
2124
|
+
() => props.center,
|
|
2125
|
+
(center, prevCenter) => {
|
|
2126
|
+
const map = mapRef.value;
|
|
2127
|
+
if (!center || !map)
|
|
2128
|
+
return;
|
|
2129
|
+
const immediately = prevCenter ? apiMapDistanceVwOfPoints(center, prevCenter) > MAX_ANIMATION_DISTANCE_VW : true;
|
|
2130
|
+
map.setCenter(center, immediately);
|
|
2131
|
+
}
|
|
2132
|
+
);
|
|
2133
|
+
Vue.watch(
|
|
2134
|
+
() => props.zoom,
|
|
2135
|
+
(zoom) => {
|
|
2136
|
+
const map = mapRef.value;
|
|
2137
|
+
if (!zoom || !map)
|
|
2138
|
+
return;
|
|
2139
|
+
map.setZoom(zoom, true);
|
|
2140
|
+
},
|
|
2141
|
+
{ immediate: false, flush: "post" }
|
|
2142
|
+
);
|
|
2074
2143
|
watchNoneImmediatePostEffectForMapProperty(mapRef, props, [
|
|
2075
|
-
{ name: "center", defaultValue: [0, 0] },
|
|
2076
2144
|
{ name: "zooms", defaultValue: [2, 20] },
|
|
2077
|
-
{ name: "zoom", defaultValue: 0 },
|
|
2078
2145
|
{ name: "layers", defaultValue: [] },
|
|
2079
2146
|
{ name: "limitBounds", defaultValue: [] },
|
|
2080
2147
|
{ name: "rotation", defaultValue: 0 },
|
|
@@ -3007,12 +3074,6 @@ const KeyedFitView = defineSetup(function KeyedFitView2(props, {
|
|
|
3007
3074
|
return Vue.h("div", [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
3008
3075
|
};
|
|
3009
3076
|
});
|
|
3010
|
-
const BEIJIN_POINT = [116.2317, 39.5427];
|
|
3011
|
-
const ZINDEX_BUBBLE_LAYER = 50;
|
|
3012
|
-
const ZINDEX_START_END_LOGO_LAYER = 40;
|
|
3013
|
-
const ZINDEX_PLACE_LAYER = 30;
|
|
3014
|
-
const ZINDEX_CAR_LAYER = 21;
|
|
3015
|
-
const ZINDEX_PASSENGER_LAYER = 20;
|
|
3016
3077
|
const imgEndPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI3Mi4zMzklIiB5MT0iNTAlIiB4Mj0iMCUiIHkyPSI1MCUiIGlkPSJwcmVmaXhfX2EiPjxzdG9wIHN0b3AtY29sb3I9IiNGRjg0NDciIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkY4QjRBIiBvZmZzZXQ9IjUwLjU5NiUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZBOTVBIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMiAzMC4yMTVjMi4xMzQgMCAzLjg2My0uODkzIDMuODYzLTEuOTk1IDAtMS4xLTEuNzMtMS45OTQtMy44NjMtMS45OTQtMi4xMzQgMC0zLjg2My44OTMtMy44NjMgMS45OTQgMCAxLjEwMiAxLjczIDEuOTk1IDMuODYzIDEuOTk1eiIgZmlsbC1vcGFjaXR5PSIuNSIgZmlsbD0iIzQzNDg1QSIvPjxwYXRoIGQ9Ik0xMSAyNy4wMDZjMi4xMjggMC0uOS0zLjc0MyA1LjYyMS02LjY0M0MxOS44NDIgMTguNDUzIDIyIDE0Ljk1MyAyMiAxMC45NSAyMiA0LjkwMiAxNy4wNzUgMCAxMSAwUzAgNC45MDIgMCAxMC45NWMwIDMuOTE4IDIuMDY4IDcuMzU2IDUuMTc3IDkuMjlDMTEuNzUgMjMuMjg0IDkuMDYgMjcuMDA3IDExIDI3LjAwN3oiIHN0cm9rZT0iI0ZGRiIgZmlsbD0idXJsKCNwcmVmaXhfX2EpIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSIvPjx0ZXh0IGZvbnQtZmFtaWx5PSJQaW5nRmFuZ1NDLVNlbWlib2xkLCBQaW5nRmFuZyBTQyIgZm9udC1zaXplPSIxMiIgZm9udC13ZWlnaHQ9IjUwMCIgZmlsbD0iI0ZGRiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMSAxLjIxNSkiPjx0c3BhbiB4PSI1IiB5PSIxNS40NDkiPue7iDwvdHNwYW4+PC90ZXh0PjwvZz48L3N2Zz4=";
|
|
3017
3078
|
const imgStartPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIwJSIgeTE9IjUwJSIgeDI9IjEyOS41OTklIiB5Mj0iNTAlIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjMzZBOEZGIiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzQ4NzFGMSIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTIgMzAuMjE1YzEuOTUgMCAzLjUzMi0uODE2IDMuNTMyLTEuODIzIDAtMS4wMDctMS41ODEtMS44MjMtMy41MzItMS44MjMtMS45NSAwLTMuNTMyLjgxNi0zLjUzMiAxLjgyMyAwIDEuMDA3IDEuNTgxIDEuODIzIDMuNTMyIDEuODIzeiIgZmlsbC1vcGFjaXR5PSIuNSIgZmlsbD0iIzQzNDg1QSIvPjxwYXRoIGQ9Ik0xMSAyN2MyLjEyOCAwLS45LTMuNzQyIDUuNjIxLTYuNjQxIDMuMjIxLTEuOTEgNS4zNzktNS40MSA1LjM3OS05LjQxMkMyMiA0LjkwMSAxNy4wNzUgMCAxMSAwUzAgNC45MDEgMCAxMC45NDdjMCAzLjkxOCAyLjA2OCA3LjM1NSA1LjE3NyA5LjI5QzExLjc1IDIzLjI3NyA5LjA2IDI3IDExIDI3eiIgc3Ryb2tlPSIjRkZGIiBmaWxsPSJ1cmwoI3ByZWZpeF9fYSkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMS4yMTUpIi8+PHRleHQgZm9udC1mYW1pbHk9IlBpbmdGYW5nU0MtU2VtaWJvbGQsIFBpbmdGYW5nIFNDIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0iNTAwIiBmaWxsPSIjRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSI+PHRzcGFuIHg9IjUiIHk9IjE1LjYyNCI+6LW3PC90c3Bhbj48L3RleHQ+PC9nPjwvc3ZnPg==";
|
|
3018
3079
|
const StartEndPoint_css_ts_vanilla = "";
|
|
@@ -3029,12 +3090,12 @@ const AStartEndPoint = defineSetup(function AStartEndPoint2(props) {
|
|
|
3029
3090
|
const icon = props.type === "start" ? imgStartPoint : imgEndPoint;
|
|
3030
3091
|
const descriptionRow = !props.description ? "" : decodeAsterisk(props.description).map((item) => item.type === "normal" ? item.value : `<span class="${pointInfoBoxEmphasize$1}">${item.value}</span>`).join("");
|
|
3031
3092
|
if (!props.description && !props.title)
|
|
3032
|
-
return `<img
|
|
3093
|
+
return `<img class="AStartEndPoint ${pointIcon({
|
|
3033
3094
|
type: props.type
|
|
3034
|
-
})}">`;
|
|
3095
|
+
})}" src="${icon}">`;
|
|
3035
3096
|
if (!props.description)
|
|
3036
3097
|
return `
|
|
3037
|
-
<div class="${pointLayout$1}">
|
|
3098
|
+
<div class="AStartEndPoint ${pointLayout$1}">
|
|
3038
3099
|
<div class="${pointSingleInfoBox$1}">
|
|
3039
3100
|
<div class="${pointInfoBoxTitle}">${props.title}</div>
|
|
3040
3101
|
</div>
|
|
@@ -3044,7 +3105,7 @@ const AStartEndPoint = defineSetup(function AStartEndPoint2(props) {
|
|
|
3044
3105
|
</div>
|
|
3045
3106
|
`;
|
|
3046
3107
|
return `
|
|
3047
|
-
<div class="${pointLayout$1}">
|
|
3108
|
+
<div class="AStartEndPoint ${pointLayout$1}">
|
|
3048
3109
|
<div class="${pointInfoBox}">
|
|
3049
3110
|
<div class="${pointInfoBoxTitle}">${(_a = props.title) != null ? _a : ""}</div>
|
|
3050
3111
|
<div class="${pointInfoBoxDescription}">${descriptionRow}</div>
|
|
@@ -3072,14 +3133,14 @@ const GStartEndPoint = defineSetup(function GStartEndPoint2(props) {
|
|
|
3072
3133
|
const descriptionRow = !props.description ? "" : decodeAsterisk(props.description).map((item) => item.type === "normal" ? item.value : `<span class="${pointInfoBoxEmphasize$1}">${item.value}</span>`).join("");
|
|
3073
3134
|
if (!props.description && !props.title)
|
|
3074
3135
|
return createDom("img", {
|
|
3075
|
-
class: pointIcon({
|
|
3136
|
+
class: `GStartEndPoint ${pointIcon({
|
|
3076
3137
|
type: props.type
|
|
3077
|
-
})
|
|
3138
|
+
})}`,
|
|
3078
3139
|
src: icon
|
|
3079
3140
|
});
|
|
3080
3141
|
if (!props.description)
|
|
3081
3142
|
return createDom("div", {
|
|
3082
|
-
class: pointLayout$1
|
|
3143
|
+
class: `GStartEndPoint ${pointLayout$1}`
|
|
3083
3144
|
}, `
|
|
3084
3145
|
<div class="${pointSingleInfoBox$1}">
|
|
3085
3146
|
<div class="${pointInfoBoxTitle}">${props.title}</div>
|
|
@@ -3089,7 +3150,7 @@ const GStartEndPoint = defineSetup(function GStartEndPoint2(props) {
|
|
|
3089
3150
|
})}">
|
|
3090
3151
|
`);
|
|
3091
3152
|
return createDom("div", {
|
|
3092
|
-
class: pointLayout$1
|
|
3153
|
+
class: `GStartEndPoint ${pointLayout$1}`
|
|
3093
3154
|
}, `
|
|
3094
3155
|
<div class="${pointInfoBox}">
|
|
3095
3156
|
<div class="${pointInfoBoxTitle}">${(_a = props.title) != null ? _a : ""}</div>
|
|
@@ -3262,6 +3323,20 @@ const watchVisibilityState = () => {
|
|
|
3262
3323
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
3263
3324
|
return { visibilityStateRef, unwatchVisibilityState };
|
|
3264
3325
|
};
|
|
3326
|
+
const isPlace = (place) => {
|
|
3327
|
+
return place.lng !== void 0 && place.lat !== void 0;
|
|
3328
|
+
};
|
|
3329
|
+
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
3330
|
+
const assertPoint = (point) => {
|
|
3331
|
+
if (Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number")
|
|
3332
|
+
return;
|
|
3333
|
+
throw new Error(`Assertion Error: expect type [number, number], actual is ${point}`);
|
|
3334
|
+
};
|
|
3335
|
+
const assertAngle = (angle) => {
|
|
3336
|
+
if (typeof angle === "number" || typeof angle === "undefined")
|
|
3337
|
+
return;
|
|
3338
|
+
throw new Error(`Assertion Error: expect type number | undefined, actual is ${angle}`);
|
|
3339
|
+
};
|
|
3265
3340
|
const WX_GET_LOCATION_INTERVAL_STILL = 10 * 1e3;
|
|
3266
3341
|
const WX_GET_LOCATION_INTERVAL_SLOW = 3 * 1e3;
|
|
3267
3342
|
const WX_GET_LOCATION_INTERVAL_FAST = 1 * 1e3;
|
|
@@ -3269,7 +3344,6 @@ const takeIsForceBrowserGeo = () => {
|
|
|
3269
3344
|
const searchParam = new URLSearchParams(location.search);
|
|
3270
3345
|
return searchParam.has(`force-browser-geo`);
|
|
3271
3346
|
};
|
|
3272
|
-
const sleep$1 = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
3273
3347
|
const wxReady = () => new Promise((resolve, reject) => {
|
|
3274
3348
|
wx.ready(resolve);
|
|
3275
3349
|
wx.error(reject);
|
|
@@ -3293,7 +3367,7 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
3293
3367
|
await wxReady();
|
|
3294
3368
|
do {
|
|
3295
3369
|
if (visibilityStateRef.value === "hidden") {
|
|
3296
|
-
await sleep
|
|
3370
|
+
await sleep(WX_GET_LOCATION_INTERVAL_FAST);
|
|
3297
3371
|
continue;
|
|
3298
3372
|
}
|
|
3299
3373
|
const geoPosition = await new Promise((resolve) => {
|
|
@@ -3334,7 +3408,7 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
3334
3408
|
if (geoPosition && !isGeoPositionEqual(geoPosition, prevGeoPosition))
|
|
3335
3409
|
onSuccess(geoPosition);
|
|
3336
3410
|
prevGeoPosition = geoPosition;
|
|
3337
|
-
await sleep
|
|
3411
|
+
await sleep(interval);
|
|
3338
3412
|
} while (enable);
|
|
3339
3413
|
};
|
|
3340
3414
|
startWatch();
|
|
@@ -3358,20 +3432,6 @@ function compatibleWathPosition(onSuccess, onError, option) {
|
|
|
3358
3432
|
}
|
|
3359
3433
|
}
|
|
3360
3434
|
}
|
|
3361
|
-
const isPlace = (place) => {
|
|
3362
|
-
return place.lng !== void 0 && place.lat !== void 0;
|
|
3363
|
-
};
|
|
3364
|
-
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
3365
|
-
const assertPoint = (point) => {
|
|
3366
|
-
if (Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number")
|
|
3367
|
-
return;
|
|
3368
|
-
throw new Error(`Assertion Error: expect type [number, number], actual is ${point}`);
|
|
3369
|
-
};
|
|
3370
|
-
const assertAngle = (angle) => {
|
|
3371
|
-
if (typeof angle === "number" || typeof angle === "undefined")
|
|
3372
|
-
return;
|
|
3373
|
-
throw new Error(`Assertion Error: expect type number | undefined, actual is ${angle}`);
|
|
3374
|
-
};
|
|
3375
3435
|
class SingleGeoWatch {
|
|
3376
3436
|
constructor(option) {
|
|
3377
3437
|
__publicField(this, "id", 0);
|
|
@@ -3511,16 +3571,33 @@ const useGeoLocation = (props) => {
|
|
|
3511
3571
|
geoReady: readyRef
|
|
3512
3572
|
};
|
|
3513
3573
|
};
|
|
3574
|
+
const MAX_AMAP_PAN_TO_ANIMATE_DURATION = 500;
|
|
3575
|
+
const MIN_AMAP_PAN_TO_ANIMATE_DURATION = 100;
|
|
3514
3576
|
const useHeycarAmap = () => {
|
|
3515
3577
|
const amapRef = Vue.shallowRef();
|
|
3516
3578
|
const amapElementRef = Vue.shallowRef();
|
|
3579
|
+
const { apiMapDistanceVwOfPoints } = useMapLngLatToVw({ mapRef: amapRef });
|
|
3517
3580
|
const setMap = (map) => {
|
|
3518
3581
|
amapRef.value = map;
|
|
3519
3582
|
amapElementRef.value = map.getContainer();
|
|
3520
3583
|
};
|
|
3521
|
-
const panTo = (value) => {
|
|
3522
|
-
|
|
3523
|
-
|
|
3584
|
+
const panTo = async (value) => {
|
|
3585
|
+
const amap2 = amapRef.value;
|
|
3586
|
+
if (!amap2)
|
|
3587
|
+
return;
|
|
3588
|
+
const { lng, lat } = amap2.getCenter();
|
|
3589
|
+
const distanceVw = apiMapDistanceVwOfPoints(value, [lng, lat]);
|
|
3590
|
+
const shouldAnimate = distanceVw < MAX_ANIMATION_DISTANCE_VW;
|
|
3591
|
+
if (shouldAnimate) {
|
|
3592
|
+
const duration = Math.max(
|
|
3593
|
+
MIN_AMAP_PAN_TO_ANIMATE_DURATION,
|
|
3594
|
+
Math.floor(MAX_AMAP_PAN_TO_ANIMATE_DURATION * distanceVw / MAX_ANIMATION_DISTANCE_VW)
|
|
3595
|
+
);
|
|
3596
|
+
amap2.panTo(value, duration);
|
|
3597
|
+
await sleep(duration);
|
|
3598
|
+
} else {
|
|
3599
|
+
amap2.setCenter(value, true);
|
|
3600
|
+
}
|
|
3524
3601
|
};
|
|
3525
3602
|
return { mapRef: amapRef, mapElementRef: amapElementRef, panTo, setMap };
|
|
3526
3603
|
};
|
|
@@ -5391,7 +5468,7 @@ const useAmapZoom = (props) => {
|
|
|
5391
5468
|
const setZoom = (v) => {
|
|
5392
5469
|
var _a2;
|
|
5393
5470
|
zoomRef.value = v;
|
|
5394
|
-
(_a2 = mapRef.value) == null ? void 0 : _a2.setZoom(v);
|
|
5471
|
+
(_a2 = mapRef.value) == null ? void 0 : _a2.setZoom(v, true);
|
|
5395
5472
|
};
|
|
5396
5473
|
const handleZoomEnd = (_, { target }) => {
|
|
5397
5474
|
const zoom = target.getZoom();
|
|
@@ -5445,9 +5522,9 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
|
|
|
5445
5522
|
const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
|
|
5446
5523
|
const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
|
|
5447
5524
|
return `
|
|
5448
|
-
<img
|
|
5525
|
+
<img class="APassengerCircle ${passengerCircle({
|
|
5449
5526
|
type
|
|
5450
|
-
})}" style="${style2}">
|
|
5527
|
+
})}" style="${style2}" src="${src}">
|
|
5451
5528
|
`;
|
|
5452
5529
|
});
|
|
5453
5530
|
return () => {
|
|
@@ -5472,9 +5549,9 @@ const GPassengerCircle = defineSetup(function GPassengerCircle2(props) {
|
|
|
5472
5549
|
const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
|
|
5473
5550
|
const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
|
|
5474
5551
|
return createDom("img", {
|
|
5475
|
-
class: passengerCircle({
|
|
5552
|
+
class: `GPassengerCircle ${passengerCircle({
|
|
5476
5553
|
type
|
|
5477
|
-
})
|
|
5554
|
+
})}`,
|
|
5478
5555
|
src,
|
|
5479
5556
|
style: style2
|
|
5480
5557
|
});
|
|
@@ -5528,42 +5605,15 @@ const ConditionalFittablePassengerCircle = defineSetup(function ConditionalFitta
|
|
|
5528
5605
|
})]);
|
|
5529
5606
|
};
|
|
5530
5607
|
});
|
|
5531
|
-
const useAmapLngLatToVw = () => {
|
|
5532
|
-
const amap2 = useAmap();
|
|
5533
|
-
const apiMapLngLatToVw = (point) => {
|
|
5534
|
-
var _a;
|
|
5535
|
-
return (_a = amap2 == null ? void 0 : amap2.value) == null ? void 0 : _a.lngLatToContainer(point).toArray();
|
|
5536
|
-
};
|
|
5537
|
-
return { apiMapLngLatToVw };
|
|
5538
|
-
};
|
|
5539
|
-
const useGmapLngLatToVw = () => {
|
|
5540
|
-
const gmap2 = useGmap();
|
|
5541
|
-
const apiMapLngLatToVw = (point) => {
|
|
5542
|
-
var _a, _b, _c, _d, _e;
|
|
5543
|
-
const [lng, lat] = point;
|
|
5544
|
-
const projection = (_a = gmap2 == null ? void 0 : gmap2.value) == null ? void 0 : _a.getProjection();
|
|
5545
|
-
const worldCoordinate = projection == null ? void 0 : projection.fromLatLngToPoint({ lng, lat });
|
|
5546
|
-
const x = (_b = worldCoordinate == null ? void 0 : worldCoordinate.x) != null ? _b : 0;
|
|
5547
|
-
const y = (_c = worldCoordinate == null ? void 0 : worldCoordinate.y) != null ? _c : 0;
|
|
5548
|
-
const zoom = (_e = (_d = gmap2 == null ? void 0 : gmap2.value) == null ? void 0 : _d.getZoom()) != null ? _e : 0;
|
|
5549
|
-
const scale = 2 ** zoom;
|
|
5550
|
-
return [x * scale, y * scale];
|
|
5551
|
-
};
|
|
5552
|
-
return { apiMapLngLatToVw };
|
|
5553
|
-
};
|
|
5554
|
-
const useMapLngLatToVw = () => {
|
|
5555
|
-
const { supplier } = useMapSupplier();
|
|
5556
|
-
return supplier === "gmap" ? useGmapLngLatToVw() : useAmapLngLatToVw();
|
|
5557
|
-
};
|
|
5558
5608
|
const reverse = (direction) => direction === "left" ? "right" : "left";
|
|
5559
5609
|
const usePointsLabelDirection = (props) => {
|
|
5560
5610
|
const { widthLimit, heightLimit } = props;
|
|
5561
|
-
const
|
|
5611
|
+
const mapRef = useMap();
|
|
5612
|
+
const { apiMapLngLatToVw } = useMapLngLatToVw({ mapRef });
|
|
5562
5613
|
const diffVw = (from, to) => {
|
|
5563
|
-
const vw = 100 / window.innerWidth;
|
|
5564
5614
|
const [x1, y1] = apiMapLngLatToVw(from);
|
|
5565
5615
|
const [x2, y2] = apiMapLngLatToVw(to);
|
|
5566
|
-
return [
|
|
5616
|
+
return [x2 - x1, y2 - y1];
|
|
5567
5617
|
};
|
|
5568
5618
|
const directionsRef = Vue.ref(Array(props.places.length).fill("right"));
|
|
5569
5619
|
watchEffectForDeepOption(
|
|
@@ -5631,7 +5681,7 @@ const APlaceCircle = defineSetup(function APlaceCircle2(props, {
|
|
|
5631
5681
|
hideIcon = false
|
|
5632
5682
|
} = props;
|
|
5633
5683
|
return `
|
|
5634
|
-
<div class="${placeCircleLayout({
|
|
5684
|
+
<div class="APlaceCircle ${placeCircleLayout({
|
|
5635
5685
|
textAlign: textAlignRef.value
|
|
5636
5686
|
})}">
|
|
5637
5687
|
<img class="${placeIcon({
|
|
@@ -5647,7 +5697,7 @@ const APlaceCircle = defineSetup(function APlaceCircle2(props, {
|
|
|
5647
5697
|
const {
|
|
5648
5698
|
hideIcon = false
|
|
5649
5699
|
} = props;
|
|
5650
|
-
return `<img class="${placeIcon({
|
|
5700
|
+
return `<img class="APlaceCircle ${placeIcon({
|
|
5651
5701
|
hideIcon
|
|
5652
5702
|
})} ${amapPlaceIconLayout({
|
|
5653
5703
|
textAlign: textAlignRef.value
|
|
@@ -5682,7 +5732,7 @@ const GPlaceCircle = defineSetup(function GPlaceCircle2(props, {
|
|
|
5682
5732
|
hideIcon = false
|
|
5683
5733
|
} = props;
|
|
5684
5734
|
return createDom("div", {
|
|
5685
|
-
class:
|
|
5735
|
+
class: `GPlaceCircle ${placeCircleLayout({
|
|
5686
5736
|
textAlign: textAlignRef.value
|
|
5687
5737
|
})} ${gmapPlaceIconLayout({
|
|
5688
5738
|
textAlign: textAlignRef.value
|
|
@@ -5699,7 +5749,7 @@ const GPlaceCircle = defineSetup(function GPlaceCircle2(props, {
|
|
|
5699
5749
|
hideIcon = false
|
|
5700
5750
|
} = props;
|
|
5701
5751
|
return createDom("img", {
|
|
5702
|
-
class:
|
|
5752
|
+
class: `GPlaceCircle ${placeIcon({
|
|
5703
5753
|
hideIcon
|
|
5704
5754
|
})} ${gmapPlaceIconLayout({
|
|
5705
5755
|
textAlign: textAlignRef.value
|
|
@@ -5762,27 +5812,18 @@ const PickupPoints = defineSetup(function PickupPoints2(props, {
|
|
|
5762
5812
|
})]);
|
|
5763
5813
|
};
|
|
5764
5814
|
});
|
|
5765
|
-
const useFirstWorkflowRecomendLoading = () => {
|
|
5766
|
-
const isFirstWorkflowRecomendLoadingRef = Vue.ref(true);
|
|
5767
|
-
const completeFirstWorkflowRecomend = () => {
|
|
5768
|
-
if (!isFirstWorkflowRecomendLoadingRef.value)
|
|
5769
|
-
return;
|
|
5770
|
-
isFirstWorkflowRecomendLoadingRef.value = false;
|
|
5771
|
-
};
|
|
5772
|
-
return { isFirstWorkflowRecomendLoadingRef, completeFirstWorkflowRecomend };
|
|
5773
|
-
};
|
|
5774
5815
|
const RECOMMEND_PLACE_DRAG_LIMIT = 10;
|
|
5775
5816
|
const RECOMMEND_PLACE_LARGE_LIMIT = 100;
|
|
5776
5817
|
const RECOMMEND_PLACE_ZOOM_MIN = 13;
|
|
5777
5818
|
const DEFAULT_PLACE_NAME = "当前位置";
|
|
5778
|
-
const DEFAULT_ZOOM =
|
|
5779
|
-
const READY_ZOOM = 17;
|
|
5819
|
+
const DEFAULT_ZOOM = 17;
|
|
5780
5820
|
const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
|
|
5781
5821
|
emit,
|
|
5782
5822
|
slots
|
|
5783
5823
|
}) {
|
|
5784
5824
|
var _a, _b;
|
|
5785
5825
|
const {
|
|
5826
|
+
geoLoadingTitle,
|
|
5786
5827
|
geoDefaultPosition,
|
|
5787
5828
|
getRecomendPlace,
|
|
5788
5829
|
getDefaultCenterPlace,
|
|
@@ -5799,21 +5840,16 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5799
5840
|
readyPromise
|
|
5800
5841
|
} = useMapSupplier();
|
|
5801
5842
|
const {
|
|
5802
|
-
zoomRef
|
|
5803
|
-
setZoom
|
|
5843
|
+
zoomRef
|
|
5804
5844
|
} = useMapZoom({
|
|
5805
5845
|
mapRef,
|
|
5806
5846
|
defaultValue: DEFAULT_ZOOM
|
|
5807
5847
|
});
|
|
5808
|
-
const {
|
|
5809
|
-
isFirstWorkflowRecomendLoadingRef,
|
|
5810
|
-
completeFirstWorkflowRecomend
|
|
5811
|
-
} = useFirstWorkflowRecomendLoading();
|
|
5812
5848
|
const centerPlace = Vue.reactive({
|
|
5813
5849
|
lng: (_a = geoDefaultPosition == null ? void 0 : geoDefaultPosition[0]) != null ? _a : 0,
|
|
5814
5850
|
lat: (_b = geoDefaultPosition == null ? void 0 : geoDefaultPosition[1]) != null ? _b : 0,
|
|
5815
|
-
name:
|
|
5816
|
-
displayName:
|
|
5851
|
+
name: geoLoadingTitle,
|
|
5852
|
+
displayName: geoLoadingTitle
|
|
5817
5853
|
});
|
|
5818
5854
|
const centerPoint = Vue.computed(() => [centerPlace.lng, centerPlace.lat]);
|
|
5819
5855
|
const centerSource = {
|
|
@@ -5834,14 +5870,17 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5834
5870
|
...place
|
|
5835
5871
|
});
|
|
5836
5872
|
updatePlaceCandidates(place);
|
|
5837
|
-
await pipeDefer(setZoom)(READY_ZOOM);
|
|
5838
5873
|
};
|
|
5839
|
-
const
|
|
5874
|
+
const panToCenterByPlace = async (place) => {
|
|
5840
5875
|
centerSource.source = "api";
|
|
5876
|
+
await panTo(place2point(place));
|
|
5841
5877
|
centerPlace.lng = place.lng;
|
|
5842
5878
|
centerPlace.lat = place.lat;
|
|
5843
5879
|
centerPlace.name = place.name;
|
|
5844
5880
|
centerPlace.displayName = place.displayName;
|
|
5881
|
+
emit("changePlace", {
|
|
5882
|
+
...place
|
|
5883
|
+
});
|
|
5845
5884
|
};
|
|
5846
5885
|
const defaultCenterPlacePromise = new Promise((resolve) => {
|
|
5847
5886
|
getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
|
|
@@ -5872,9 +5911,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5872
5911
|
await setCenterPlaceByUserSpecified(place);
|
|
5873
5912
|
} else {
|
|
5874
5913
|
updatePlace(value.position);
|
|
5875
|
-
await pipeDefer(setZoom)(READY_ZOOM);
|
|
5876
5914
|
}
|
|
5877
|
-
completeFirstWorkflowRecomend();
|
|
5878
5915
|
},
|
|
5879
5916
|
onChange: (v) => emit("changeGeoLocation", v),
|
|
5880
5917
|
onError: (e) => {
|
|
@@ -5931,14 +5968,12 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5931
5968
|
},
|
|
5932
5969
|
onChange: async (place) => {
|
|
5933
5970
|
centerSource.source = "recomend";
|
|
5971
|
+
if (isPlaceEqual(place, centerPlace))
|
|
5972
|
+
panTo(place2point(place));
|
|
5934
5973
|
Object.assign(centerPlace, {
|
|
5935
5974
|
...place
|
|
5936
5975
|
});
|
|
5937
|
-
panTo(place2point(place));
|
|
5938
5976
|
emit("changeRecomandPlace", place);
|
|
5939
|
-
if (isFirstWorkflowRecomendLoadingRef.value)
|
|
5940
|
-
await pipeDefer(setZoom)(READY_ZOOM);
|
|
5941
|
-
completeFirstWorkflowRecomend();
|
|
5942
5977
|
}
|
|
5943
5978
|
});
|
|
5944
5979
|
Vue.watchEffect(() => {
|
|
@@ -5951,11 +5986,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5951
5986
|
});
|
|
5952
5987
|
return () => {
|
|
5953
5988
|
const {
|
|
5954
|
-
geoLoadingTitle,
|
|
5989
|
+
geoLoadingTitle: geoLoadingTitle2,
|
|
5955
5990
|
recomendDescription,
|
|
5956
5991
|
unavailableTitle
|
|
5957
5992
|
} = props;
|
|
5958
|
-
const title = geoLoading.value ?
|
|
5993
|
+
const title = geoLoading.value ? geoLoadingTitle2 : !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
5959
5994
|
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
|
|
5960
5995
|
return Vue.h(HeycarMap, {
|
|
5961
5996
|
"attrs": {
|
|
@@ -5977,9 +6012,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5977
6012
|
"renderLabel": (place) => isPlaceEqual(place, centerPlace) ? void 0 : place.displayName
|
|
5978
6013
|
},
|
|
5979
6014
|
"on": {
|
|
5980
|
-
"click":
|
|
6015
|
+
"click": panToCenterByPlace
|
|
5981
6016
|
}
|
|
5982
|
-
}), geoLoading.value
|
|
6017
|
+
}), geoLoading.value ? null : Vue.h(AbsoluteAddressBox, {
|
|
5983
6018
|
"attrs": {
|
|
5984
6019
|
"title": title,
|
|
5985
6020
|
"description": description,
|
|
@@ -6038,10 +6073,10 @@ const ATaxiCar = defineSetup(function ATaxiCar2(props) {
|
|
|
6038
6073
|
const carStyle = `transform:rotate(${(_a = props.angle) != null ? _a : 0}deg)`;
|
|
6039
6074
|
if (!props.title)
|
|
6040
6075
|
return {
|
|
6041
|
-
img: `<img
|
|
6076
|
+
img: `<img class="ATaxiCar ${carIcon}" src="${imgTaxicar}" style="${carStyle}">`
|
|
6042
6077
|
};
|
|
6043
6078
|
const content = (hide$1) => `
|
|
6044
|
-
<div class="${pointLayout}">
|
|
6079
|
+
<div class="ATaxiCar ${pointLayout}">
|
|
6045
6080
|
<div class="${pointSingleInfoBox} ${hide({
|
|
6046
6081
|
hide: !hide$1
|
|
6047
6082
|
})}">
|
|
@@ -6083,13 +6118,13 @@ const GTaxiCar = defineSetup(function GTaxiCar2(props) {
|
|
|
6083
6118
|
if (!props.title)
|
|
6084
6119
|
return {
|
|
6085
6120
|
img: createDom("img", {
|
|
6086
|
-
class: carIcon
|
|
6121
|
+
class: `GTaxiCar ${carIcon}`,
|
|
6087
6122
|
src: imgTaxicar,
|
|
6088
6123
|
style: carStyle
|
|
6089
6124
|
})
|
|
6090
6125
|
};
|
|
6091
6126
|
const content = (hide$1) => createDom("div", {
|
|
6092
|
-
class: pointLayout
|
|
6127
|
+
class: `GTaxiCar ${pointLayout}`
|
|
6093
6128
|
}, `
|
|
6094
6129
|
<div class="${pointSingleInfoBox} ${hide({
|
|
6095
6130
|
hide: !hide$1
|
|
@@ -6314,8 +6349,8 @@ const WaveCircle_css_ts_vanilla = "";
|
|
|
6314
6349
|
var secondCircle = "rrvp0y3";
|
|
6315
6350
|
var waveCircle = "rrvp0y2";
|
|
6316
6351
|
const AWaveCircle = defineSetup(function AWaveCircle2(props) {
|
|
6317
|
-
const contentRef = Vue.computed(() => `<img
|
|
6318
|
-
const contentAnotherRef = Vue.computed(() => `<img
|
|
6352
|
+
const contentRef = Vue.computed(() => `<img class="AWaveCircle ${waveCircle}" src="${imgWaveCircle}">`);
|
|
6353
|
+
const contentAnotherRef = Vue.computed(() => `<img class="AWaveCircle ${waveCircle} ${secondCircle}" src="${imgWaveCircle}">`);
|
|
6319
6354
|
return () => Vue.h("div", [Vue.h(AmapMarker, {
|
|
6320
6355
|
"attrs": {
|
|
6321
6356
|
"position": props.position,
|
|
@@ -6332,11 +6367,11 @@ const AWaveCircle = defineSetup(function AWaveCircle2(props) {
|
|
|
6332
6367
|
});
|
|
6333
6368
|
const GWaveCircle = defineSetup(function GWaveCircle2(props) {
|
|
6334
6369
|
const contentRef = Vue.computed(() => createDom("img", {
|
|
6335
|
-
class: waveCircle
|
|
6370
|
+
class: `GWaveCircle ${waveCircle}`,
|
|
6336
6371
|
src: imgWaveCircle
|
|
6337
6372
|
}));
|
|
6338
6373
|
const contentAnotherRef = Vue.computed(() => createDom("img", {
|
|
6339
|
-
class:
|
|
6374
|
+
class: `GWaveCircle ${waveCircle} ${secondCircle}`,
|
|
6340
6375
|
src: imgWaveCircle
|
|
6341
6376
|
}));
|
|
6342
6377
|
return () => {
|
package/dist/index.js
CHANGED
|
@@ -1981,6 +1981,54 @@ function detectWebGL() {
|
|
|
1981
1981
|
}
|
|
1982
1982
|
return "NOT_SUPPORTED";
|
|
1983
1983
|
}
|
|
1984
|
+
const MAX_ANIMATION_DISTANCE_VW = 100;
|
|
1985
|
+
const BEIJIN_POINT = [116.2317, 39.5427];
|
|
1986
|
+
const ZINDEX_BUBBLE_LAYER = 50;
|
|
1987
|
+
const ZINDEX_START_END_LOGO_LAYER = 40;
|
|
1988
|
+
const ZINDEX_PLACE_LAYER = 30;
|
|
1989
|
+
const ZINDEX_CAR_LAYER = 21;
|
|
1990
|
+
const ZINDEX_PASSENGER_LAYER = 20;
|
|
1991
|
+
const useAmapLngLatToVw = (props) => {
|
|
1992
|
+
const apiMapLngLatToVw = (point) => {
|
|
1993
|
+
const amap2 = props.mapRef.value;
|
|
1994
|
+
const sw = innerWidth;
|
|
1995
|
+
const [x, y] = amap2 == null ? void 0 : amap2.lngLatToContainer(point).toArray();
|
|
1996
|
+
return [100 * x / sw, 100 * y / sw];
|
|
1997
|
+
};
|
|
1998
|
+
const apiMapDistanceVwOfPoints = (point1, point2) => {
|
|
1999
|
+
const [x1, y1] = apiMapLngLatToVw(point1);
|
|
2000
|
+
const [x2, y2] = apiMapLngLatToVw(point2);
|
|
2001
|
+
const result = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
|
2002
|
+
console.log("distance = ", result);
|
|
2003
|
+
return result;
|
|
2004
|
+
};
|
|
2005
|
+
return { apiMapLngLatToVw, apiMapDistanceVwOfPoints };
|
|
2006
|
+
};
|
|
2007
|
+
const useGmapLngLatToVw = (props) => {
|
|
2008
|
+
const apiMapLngLatToVw = (point) => {
|
|
2009
|
+
var _a, _b, _c;
|
|
2010
|
+
const [lng, lat] = point;
|
|
2011
|
+
const gmap2 = props.mapRef.value;
|
|
2012
|
+
const sw = window.innerWidth;
|
|
2013
|
+
const projection = gmap2 == null ? void 0 : gmap2.getProjection();
|
|
2014
|
+
const worldCoordinate = projection == null ? void 0 : projection.fromLatLngToPoint({ lng, lat });
|
|
2015
|
+
const x = (_a = worldCoordinate == null ? void 0 : worldCoordinate.x) != null ? _a : 0;
|
|
2016
|
+
const y = (_b = worldCoordinate == null ? void 0 : worldCoordinate.y) != null ? _b : 0;
|
|
2017
|
+
const zoom = (_c = gmap2 == null ? void 0 : gmap2.getZoom()) != null ? _c : 0;
|
|
2018
|
+
const scale = 2 ** zoom;
|
|
2019
|
+
return [100 * x * scale / sw, 100 * y * scale / sw];
|
|
2020
|
+
};
|
|
2021
|
+
const apiMapDistanceVwOfPoints = (point1, point2) => {
|
|
2022
|
+
const [x1, y1] = apiMapLngLatToVw(point1);
|
|
2023
|
+
const [x2, y2] = apiMapLngLatToVw(point2);
|
|
2024
|
+
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
|
2025
|
+
};
|
|
2026
|
+
return { apiMapLngLatToVw, apiMapDistanceVwOfPoints };
|
|
2027
|
+
};
|
|
2028
|
+
const useMapLngLatToVw = (props) => {
|
|
2029
|
+
const { supplier } = useMapSupplier();
|
|
2030
|
+
return supplier === "gmap" ? useGmapLngLatToVw(props) : useAmapLngLatToVw(props);
|
|
2031
|
+
};
|
|
1984
2032
|
const ZOOM_WHEEL_RATIO = -135e-5;
|
|
1985
2033
|
const useAmapWheelZoomCenter = (props) => {
|
|
1986
2034
|
const { mapRef, enableRef } = props;
|
|
@@ -1989,7 +2037,7 @@ const useAmapWheelZoomCenter = (props) => {
|
|
|
1989
2037
|
const { deltaY } = e;
|
|
1990
2038
|
const prevZoom = (_b = (_a = mapRef.value) == null ? void 0 : _a.getZoom()) != null ? _b : 0;
|
|
1991
2039
|
const zoom = prevZoom + ZOOM_WHEEL_RATIO * deltaY;
|
|
1992
|
-
(_c = mapRef.value) == null ? void 0 : _c.setZoom(zoom);
|
|
2040
|
+
(_c = mapRef.value) == null ? void 0 : _c.setZoom(zoom, true);
|
|
1993
2041
|
};
|
|
1994
2042
|
watch(
|
|
1995
2043
|
() => enableRef == null ? void 0 : enableRef.value,
|
|
@@ -2049,6 +2097,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
2049
2097
|
const elementRef = shallowRef();
|
|
2050
2098
|
const mapRef = shallowRef();
|
|
2051
2099
|
provideAmap(mapRef);
|
|
2100
|
+
const { apiMapDistanceVwOfPoints } = useMapLngLatToVw({ mapRef });
|
|
2052
2101
|
useAmapWheelZoomCenter({ mapRef, enableRef: computed(() => !!props.touchZoomCenter) });
|
|
2053
2102
|
watchPostEffect(() => {
|
|
2054
2103
|
if (mapRef.value || !elementRef.value)
|
|
@@ -2069,10 +2118,28 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
2069
2118
|
(_a = mapRef.value) == null ? void 0 : _a.setStatus(statusOptions2);
|
|
2070
2119
|
}
|
|
2071
2120
|
);
|
|
2121
|
+
watchNoneImmediatePostEffectForDeepOption(
|
|
2122
|
+
() => props.center,
|
|
2123
|
+
(center, prevCenter) => {
|
|
2124
|
+
const map = mapRef.value;
|
|
2125
|
+
if (!center || !map)
|
|
2126
|
+
return;
|
|
2127
|
+
const immediately = prevCenter ? apiMapDistanceVwOfPoints(center, prevCenter) > MAX_ANIMATION_DISTANCE_VW : true;
|
|
2128
|
+
map.setCenter(center, immediately);
|
|
2129
|
+
}
|
|
2130
|
+
);
|
|
2131
|
+
watch(
|
|
2132
|
+
() => props.zoom,
|
|
2133
|
+
(zoom) => {
|
|
2134
|
+
const map = mapRef.value;
|
|
2135
|
+
if (!zoom || !map)
|
|
2136
|
+
return;
|
|
2137
|
+
map.setZoom(zoom, true);
|
|
2138
|
+
},
|
|
2139
|
+
{ immediate: false, flush: "post" }
|
|
2140
|
+
);
|
|
2072
2141
|
watchNoneImmediatePostEffectForMapProperty(mapRef, props, [
|
|
2073
|
-
{ name: "center", defaultValue: [0, 0] },
|
|
2074
2142
|
{ name: "zooms", defaultValue: [2, 20] },
|
|
2075
|
-
{ name: "zoom", defaultValue: 0 },
|
|
2076
2143
|
{ name: "layers", defaultValue: [] },
|
|
2077
2144
|
{ name: "limitBounds", defaultValue: [] },
|
|
2078
2145
|
{ name: "rotation", defaultValue: 0 },
|
|
@@ -3005,12 +3072,6 @@ const KeyedFitView = defineSetup(function KeyedFitView2(props, {
|
|
|
3005
3072
|
return h("div", [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
3006
3073
|
};
|
|
3007
3074
|
});
|
|
3008
|
-
const BEIJIN_POINT = [116.2317, 39.5427];
|
|
3009
|
-
const ZINDEX_BUBBLE_LAYER = 50;
|
|
3010
|
-
const ZINDEX_START_END_LOGO_LAYER = 40;
|
|
3011
|
-
const ZINDEX_PLACE_LAYER = 30;
|
|
3012
|
-
const ZINDEX_CAR_LAYER = 21;
|
|
3013
|
-
const ZINDEX_PASSENGER_LAYER = 20;
|
|
3014
3075
|
const imgEndPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSI3Mi4zMzklIiB5MT0iNTAlIiB4Mj0iMCUiIHkyPSI1MCUiIGlkPSJwcmVmaXhfX2EiPjxzdG9wIHN0b3AtY29sb3I9IiNGRjg0NDciIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkY4QjRBIiBvZmZzZXQ9IjUwLjU5NiUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZBOTVBIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMiAzMC4yMTVjMi4xMzQgMCAzLjg2My0uODkzIDMuODYzLTEuOTk1IDAtMS4xLTEuNzMtMS45OTQtMy44NjMtMS45OTQtMi4xMzQgMC0zLjg2My44OTMtMy44NjMgMS45OTQgMCAxLjEwMiAxLjczIDEuOTk1IDMuODYzIDEuOTk1eiIgZmlsbC1vcGFjaXR5PSIuNSIgZmlsbD0iIzQzNDg1QSIvPjxwYXRoIGQ9Ik0xMSAyNy4wMDZjMi4xMjggMC0uOS0zLjc0MyA1LjYyMS02LjY0M0MxOS44NDIgMTguNDUzIDIyIDE0Ljk1MyAyMiAxMC45NSAyMiA0LjkwMiAxNy4wNzUgMCAxMSAwUzAgNC45MDIgMCAxMC45NWMwIDMuOTE4IDIuMDY4IDcuMzU2IDUuMTc3IDkuMjlDMTEuNzUgMjMuMjg0IDkuMDYgMjcuMDA3IDExIDI3LjAwN3oiIHN0cm9rZT0iI0ZGRiIgZmlsbD0idXJsKCNwcmVmaXhfX2EpIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSIvPjx0ZXh0IGZvbnQtZmFtaWx5PSJQaW5nRmFuZ1NDLVNlbWlib2xkLCBQaW5nRmFuZyBTQyIgZm9udC1zaXplPSIxMiIgZm9udC13ZWlnaHQ9IjUwMCIgZmlsbD0iI0ZGRiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMSAxLjIxNSkiPjx0c3BhbiB4PSI1IiB5PSIxNS40NDkiPue7iDwvdHNwYW4+PC90ZXh0PjwvZz48L3N2Zz4=";
|
|
3015
3076
|
const imgStartPoint = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIwJSIgeTE9IjUwJSIgeDI9IjEyOS41OTklIiB5Mj0iNTAlIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjMzZBOEZGIiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iIzQ4NzFGMSIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTIgMzAuMjE1YzEuOTUgMCAzLjUzMi0uODE2IDMuNTMyLTEuODIzIDAtMS4wMDctMS41ODEtMS44MjMtMy41MzItMS44MjMtMS45NSAwLTMuNTMyLjgxNi0zLjUzMiAxLjgyMyAwIDEuMDA3IDEuNTgxIDEuODIzIDMuNTMyIDEuODIzeiIgZmlsbC1vcGFjaXR5PSIuNSIgZmlsbD0iIzQzNDg1QSIvPjxwYXRoIGQ9Ik0xMSAyN2MyLjEyOCAwLS45LTMuNzQyIDUuNjIxLTYuNjQxIDMuMjIxLTEuOTEgNS4zNzktNS40MSA1LjM3OS05LjQxMkMyMiA0LjkwMSAxNy4wNzUgMCAxMSAwUzAgNC45MDEgMCAxMC45NDdjMCAzLjkxOCAyLjA2OCA3LjM1NSA1LjE3NyA5LjI5QzExLjc1IDIzLjI3NyA5LjA2IDI3IDExIDI3eiIgc3Ryb2tlPSIjRkZGIiBmaWxsPSJ1cmwoI3ByZWZpeF9fYSkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMS4yMTUpIi8+PHRleHQgZm9udC1mYW1pbHk9IlBpbmdGYW5nU0MtU2VtaWJvbGQsIFBpbmdGYW5nIFNDIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0iNTAwIiBmaWxsPSIjRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxIDEuMjE1KSI+PHRzcGFuIHg9IjUiIHk9IjE1LjYyNCI+6LW3PC90c3Bhbj48L3RleHQ+PC9nPjwvc3ZnPg==";
|
|
3016
3077
|
const StartEndPoint_css_ts_vanilla = "";
|
|
@@ -3027,12 +3088,12 @@ const AStartEndPoint = defineSetup(function AStartEndPoint2(props) {
|
|
|
3027
3088
|
const icon = props.type === "start" ? imgStartPoint : imgEndPoint;
|
|
3028
3089
|
const descriptionRow = !props.description ? "" : decodeAsterisk(props.description).map((item) => item.type === "normal" ? item.value : `<span class="${pointInfoBoxEmphasize$1}">${item.value}</span>`).join("");
|
|
3029
3090
|
if (!props.description && !props.title)
|
|
3030
|
-
return `<img
|
|
3091
|
+
return `<img class="AStartEndPoint ${pointIcon({
|
|
3031
3092
|
type: props.type
|
|
3032
|
-
})}">`;
|
|
3093
|
+
})}" src="${icon}">`;
|
|
3033
3094
|
if (!props.description)
|
|
3034
3095
|
return `
|
|
3035
|
-
<div class="${pointLayout$1}">
|
|
3096
|
+
<div class="AStartEndPoint ${pointLayout$1}">
|
|
3036
3097
|
<div class="${pointSingleInfoBox$1}">
|
|
3037
3098
|
<div class="${pointInfoBoxTitle}">${props.title}</div>
|
|
3038
3099
|
</div>
|
|
@@ -3042,7 +3103,7 @@ const AStartEndPoint = defineSetup(function AStartEndPoint2(props) {
|
|
|
3042
3103
|
</div>
|
|
3043
3104
|
`;
|
|
3044
3105
|
return `
|
|
3045
|
-
<div class="${pointLayout$1}">
|
|
3106
|
+
<div class="AStartEndPoint ${pointLayout$1}">
|
|
3046
3107
|
<div class="${pointInfoBox}">
|
|
3047
3108
|
<div class="${pointInfoBoxTitle}">${(_a = props.title) != null ? _a : ""}</div>
|
|
3048
3109
|
<div class="${pointInfoBoxDescription}">${descriptionRow}</div>
|
|
@@ -3070,14 +3131,14 @@ const GStartEndPoint = defineSetup(function GStartEndPoint2(props) {
|
|
|
3070
3131
|
const descriptionRow = !props.description ? "" : decodeAsterisk(props.description).map((item) => item.type === "normal" ? item.value : `<span class="${pointInfoBoxEmphasize$1}">${item.value}</span>`).join("");
|
|
3071
3132
|
if (!props.description && !props.title)
|
|
3072
3133
|
return createDom("img", {
|
|
3073
|
-
class: pointIcon({
|
|
3134
|
+
class: `GStartEndPoint ${pointIcon({
|
|
3074
3135
|
type: props.type
|
|
3075
|
-
})
|
|
3136
|
+
})}`,
|
|
3076
3137
|
src: icon
|
|
3077
3138
|
});
|
|
3078
3139
|
if (!props.description)
|
|
3079
3140
|
return createDom("div", {
|
|
3080
|
-
class: pointLayout$1
|
|
3141
|
+
class: `GStartEndPoint ${pointLayout$1}`
|
|
3081
3142
|
}, `
|
|
3082
3143
|
<div class="${pointSingleInfoBox$1}">
|
|
3083
3144
|
<div class="${pointInfoBoxTitle}">${props.title}</div>
|
|
@@ -3087,7 +3148,7 @@ const GStartEndPoint = defineSetup(function GStartEndPoint2(props) {
|
|
|
3087
3148
|
})}">
|
|
3088
3149
|
`);
|
|
3089
3150
|
return createDom("div", {
|
|
3090
|
-
class: pointLayout$1
|
|
3151
|
+
class: `GStartEndPoint ${pointLayout$1}`
|
|
3091
3152
|
}, `
|
|
3092
3153
|
<div class="${pointInfoBox}">
|
|
3093
3154
|
<div class="${pointInfoBoxTitle}">${(_a = props.title) != null ? _a : ""}</div>
|
|
@@ -3260,6 +3321,20 @@ const watchVisibilityState = () => {
|
|
|
3260
3321
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
3261
3322
|
return { visibilityStateRef, unwatchVisibilityState };
|
|
3262
3323
|
};
|
|
3324
|
+
const isPlace = (place) => {
|
|
3325
|
+
return place.lng !== void 0 && place.lat !== void 0;
|
|
3326
|
+
};
|
|
3327
|
+
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
3328
|
+
const assertPoint = (point) => {
|
|
3329
|
+
if (Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number")
|
|
3330
|
+
return;
|
|
3331
|
+
throw new Error(`Assertion Error: expect type [number, number], actual is ${point}`);
|
|
3332
|
+
};
|
|
3333
|
+
const assertAngle = (angle) => {
|
|
3334
|
+
if (typeof angle === "number" || typeof angle === "undefined")
|
|
3335
|
+
return;
|
|
3336
|
+
throw new Error(`Assertion Error: expect type number | undefined, actual is ${angle}`);
|
|
3337
|
+
};
|
|
3263
3338
|
const WX_GET_LOCATION_INTERVAL_STILL = 10 * 1e3;
|
|
3264
3339
|
const WX_GET_LOCATION_INTERVAL_SLOW = 3 * 1e3;
|
|
3265
3340
|
const WX_GET_LOCATION_INTERVAL_FAST = 1 * 1e3;
|
|
@@ -3267,7 +3342,6 @@ const takeIsForceBrowserGeo = () => {
|
|
|
3267
3342
|
const searchParam = new URLSearchParams(location.search);
|
|
3268
3343
|
return searchParam.has(`force-browser-geo`);
|
|
3269
3344
|
};
|
|
3270
|
-
const sleep$1 = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
3271
3345
|
const wxReady = () => new Promise((resolve, reject) => {
|
|
3272
3346
|
wx.ready(resolve);
|
|
3273
3347
|
wx.error(reject);
|
|
@@ -3291,7 +3365,7 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
3291
3365
|
await wxReady();
|
|
3292
3366
|
do {
|
|
3293
3367
|
if (visibilityStateRef.value === "hidden") {
|
|
3294
|
-
await sleep
|
|
3368
|
+
await sleep(WX_GET_LOCATION_INTERVAL_FAST);
|
|
3295
3369
|
continue;
|
|
3296
3370
|
}
|
|
3297
3371
|
const geoPosition = await new Promise((resolve) => {
|
|
@@ -3332,7 +3406,7 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
3332
3406
|
if (geoPosition && !isGeoPositionEqual(geoPosition, prevGeoPosition))
|
|
3333
3407
|
onSuccess(geoPosition);
|
|
3334
3408
|
prevGeoPosition = geoPosition;
|
|
3335
|
-
await sleep
|
|
3409
|
+
await sleep(interval);
|
|
3336
3410
|
} while (enable);
|
|
3337
3411
|
};
|
|
3338
3412
|
startWatch();
|
|
@@ -3356,20 +3430,6 @@ function compatibleWathPosition(onSuccess, onError, option) {
|
|
|
3356
3430
|
}
|
|
3357
3431
|
}
|
|
3358
3432
|
}
|
|
3359
|
-
const isPlace = (place) => {
|
|
3360
|
-
return place.lng !== void 0 && place.lat !== void 0;
|
|
3361
|
-
};
|
|
3362
|
-
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
3363
|
-
const assertPoint = (point) => {
|
|
3364
|
-
if (Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number")
|
|
3365
|
-
return;
|
|
3366
|
-
throw new Error(`Assertion Error: expect type [number, number], actual is ${point}`);
|
|
3367
|
-
};
|
|
3368
|
-
const assertAngle = (angle) => {
|
|
3369
|
-
if (typeof angle === "number" || typeof angle === "undefined")
|
|
3370
|
-
return;
|
|
3371
|
-
throw new Error(`Assertion Error: expect type number | undefined, actual is ${angle}`);
|
|
3372
|
-
};
|
|
3373
3433
|
class SingleGeoWatch {
|
|
3374
3434
|
constructor(option) {
|
|
3375
3435
|
__publicField(this, "id", 0);
|
|
@@ -3509,16 +3569,33 @@ const useGeoLocation = (props) => {
|
|
|
3509
3569
|
geoReady: readyRef
|
|
3510
3570
|
};
|
|
3511
3571
|
};
|
|
3572
|
+
const MAX_AMAP_PAN_TO_ANIMATE_DURATION = 500;
|
|
3573
|
+
const MIN_AMAP_PAN_TO_ANIMATE_DURATION = 100;
|
|
3512
3574
|
const useHeycarAmap = () => {
|
|
3513
3575
|
const amapRef = shallowRef();
|
|
3514
3576
|
const amapElementRef = shallowRef();
|
|
3577
|
+
const { apiMapDistanceVwOfPoints } = useMapLngLatToVw({ mapRef: amapRef });
|
|
3515
3578
|
const setMap = (map) => {
|
|
3516
3579
|
amapRef.value = map;
|
|
3517
3580
|
amapElementRef.value = map.getContainer();
|
|
3518
3581
|
};
|
|
3519
|
-
const panTo = (value) => {
|
|
3520
|
-
|
|
3521
|
-
|
|
3582
|
+
const panTo = async (value) => {
|
|
3583
|
+
const amap2 = amapRef.value;
|
|
3584
|
+
if (!amap2)
|
|
3585
|
+
return;
|
|
3586
|
+
const { lng, lat } = amap2.getCenter();
|
|
3587
|
+
const distanceVw = apiMapDistanceVwOfPoints(value, [lng, lat]);
|
|
3588
|
+
const shouldAnimate = distanceVw < MAX_ANIMATION_DISTANCE_VW;
|
|
3589
|
+
if (shouldAnimate) {
|
|
3590
|
+
const duration = Math.max(
|
|
3591
|
+
MIN_AMAP_PAN_TO_ANIMATE_DURATION,
|
|
3592
|
+
Math.floor(MAX_AMAP_PAN_TO_ANIMATE_DURATION * distanceVw / MAX_ANIMATION_DISTANCE_VW)
|
|
3593
|
+
);
|
|
3594
|
+
amap2.panTo(value, duration);
|
|
3595
|
+
await sleep(duration);
|
|
3596
|
+
} else {
|
|
3597
|
+
amap2.setCenter(value, true);
|
|
3598
|
+
}
|
|
3522
3599
|
};
|
|
3523
3600
|
return { mapRef: amapRef, mapElementRef: amapElementRef, panTo, setMap };
|
|
3524
3601
|
};
|
|
@@ -5389,7 +5466,7 @@ const useAmapZoom = (props) => {
|
|
|
5389
5466
|
const setZoom = (v) => {
|
|
5390
5467
|
var _a2;
|
|
5391
5468
|
zoomRef.value = v;
|
|
5392
|
-
(_a2 = mapRef.value) == null ? void 0 : _a2.setZoom(v);
|
|
5469
|
+
(_a2 = mapRef.value) == null ? void 0 : _a2.setZoom(v, true);
|
|
5393
5470
|
};
|
|
5394
5471
|
const handleZoomEnd = (_, { target }) => {
|
|
5395
5472
|
const zoom = target.getZoom();
|
|
@@ -5443,9 +5520,9 @@ const APassengerCircle = defineSetup(function APassengerCircle2(props) {
|
|
|
5443
5520
|
const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
|
|
5444
5521
|
const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
|
|
5445
5522
|
return `
|
|
5446
|
-
<img
|
|
5523
|
+
<img class="APassengerCircle ${passengerCircle({
|
|
5447
5524
|
type
|
|
5448
|
-
})}" style="${style2}">
|
|
5525
|
+
})}" style="${style2}" src="${src}">
|
|
5449
5526
|
`;
|
|
5450
5527
|
});
|
|
5451
5528
|
return () => {
|
|
@@ -5470,9 +5547,9 @@ const GPassengerCircle = defineSetup(function GPassengerCircle2(props) {
|
|
|
5470
5547
|
const style2 = angle === void 0 ? "" : `transform: rotate(var(${angle}))`;
|
|
5471
5548
|
const type = size === "large" ? angle === void 0 ? "large" : "largeArrow" : angle === void 0 ? "small" : "smallArrow";
|
|
5472
5549
|
return createDom("img", {
|
|
5473
|
-
class: passengerCircle({
|
|
5550
|
+
class: `GPassengerCircle ${passengerCircle({
|
|
5474
5551
|
type
|
|
5475
|
-
})
|
|
5552
|
+
})}`,
|
|
5476
5553
|
src,
|
|
5477
5554
|
style: style2
|
|
5478
5555
|
});
|
|
@@ -5526,42 +5603,15 @@ const ConditionalFittablePassengerCircle = defineSetup(function ConditionalFitta
|
|
|
5526
5603
|
})]);
|
|
5527
5604
|
};
|
|
5528
5605
|
});
|
|
5529
|
-
const useAmapLngLatToVw = () => {
|
|
5530
|
-
const amap2 = useAmap();
|
|
5531
|
-
const apiMapLngLatToVw = (point) => {
|
|
5532
|
-
var _a;
|
|
5533
|
-
return (_a = amap2 == null ? void 0 : amap2.value) == null ? void 0 : _a.lngLatToContainer(point).toArray();
|
|
5534
|
-
};
|
|
5535
|
-
return { apiMapLngLatToVw };
|
|
5536
|
-
};
|
|
5537
|
-
const useGmapLngLatToVw = () => {
|
|
5538
|
-
const gmap2 = useGmap();
|
|
5539
|
-
const apiMapLngLatToVw = (point) => {
|
|
5540
|
-
var _a, _b, _c, _d, _e;
|
|
5541
|
-
const [lng, lat] = point;
|
|
5542
|
-
const projection = (_a = gmap2 == null ? void 0 : gmap2.value) == null ? void 0 : _a.getProjection();
|
|
5543
|
-
const worldCoordinate = projection == null ? void 0 : projection.fromLatLngToPoint({ lng, lat });
|
|
5544
|
-
const x = (_b = worldCoordinate == null ? void 0 : worldCoordinate.x) != null ? _b : 0;
|
|
5545
|
-
const y = (_c = worldCoordinate == null ? void 0 : worldCoordinate.y) != null ? _c : 0;
|
|
5546
|
-
const zoom = (_e = (_d = gmap2 == null ? void 0 : gmap2.value) == null ? void 0 : _d.getZoom()) != null ? _e : 0;
|
|
5547
|
-
const scale = 2 ** zoom;
|
|
5548
|
-
return [x * scale, y * scale];
|
|
5549
|
-
};
|
|
5550
|
-
return { apiMapLngLatToVw };
|
|
5551
|
-
};
|
|
5552
|
-
const useMapLngLatToVw = () => {
|
|
5553
|
-
const { supplier } = useMapSupplier();
|
|
5554
|
-
return supplier === "gmap" ? useGmapLngLatToVw() : useAmapLngLatToVw();
|
|
5555
|
-
};
|
|
5556
5606
|
const reverse = (direction) => direction === "left" ? "right" : "left";
|
|
5557
5607
|
const usePointsLabelDirection = (props) => {
|
|
5558
5608
|
const { widthLimit, heightLimit } = props;
|
|
5559
|
-
const
|
|
5609
|
+
const mapRef = useMap();
|
|
5610
|
+
const { apiMapLngLatToVw } = useMapLngLatToVw({ mapRef });
|
|
5560
5611
|
const diffVw = (from, to) => {
|
|
5561
|
-
const vw = 100 / window.innerWidth;
|
|
5562
5612
|
const [x1, y1] = apiMapLngLatToVw(from);
|
|
5563
5613
|
const [x2, y2] = apiMapLngLatToVw(to);
|
|
5564
|
-
return [
|
|
5614
|
+
return [x2 - x1, y2 - y1];
|
|
5565
5615
|
};
|
|
5566
5616
|
const directionsRef = ref(Array(props.places.length).fill("right"));
|
|
5567
5617
|
watchEffectForDeepOption(
|
|
@@ -5629,7 +5679,7 @@ const APlaceCircle = defineSetup(function APlaceCircle2(props, {
|
|
|
5629
5679
|
hideIcon = false
|
|
5630
5680
|
} = props;
|
|
5631
5681
|
return `
|
|
5632
|
-
<div class="${placeCircleLayout({
|
|
5682
|
+
<div class="APlaceCircle ${placeCircleLayout({
|
|
5633
5683
|
textAlign: textAlignRef.value
|
|
5634
5684
|
})}">
|
|
5635
5685
|
<img class="${placeIcon({
|
|
@@ -5645,7 +5695,7 @@ const APlaceCircle = defineSetup(function APlaceCircle2(props, {
|
|
|
5645
5695
|
const {
|
|
5646
5696
|
hideIcon = false
|
|
5647
5697
|
} = props;
|
|
5648
|
-
return `<img class="${placeIcon({
|
|
5698
|
+
return `<img class="APlaceCircle ${placeIcon({
|
|
5649
5699
|
hideIcon
|
|
5650
5700
|
})} ${amapPlaceIconLayout({
|
|
5651
5701
|
textAlign: textAlignRef.value
|
|
@@ -5680,7 +5730,7 @@ const GPlaceCircle = defineSetup(function GPlaceCircle2(props, {
|
|
|
5680
5730
|
hideIcon = false
|
|
5681
5731
|
} = props;
|
|
5682
5732
|
return createDom("div", {
|
|
5683
|
-
class:
|
|
5733
|
+
class: `GPlaceCircle ${placeCircleLayout({
|
|
5684
5734
|
textAlign: textAlignRef.value
|
|
5685
5735
|
})} ${gmapPlaceIconLayout({
|
|
5686
5736
|
textAlign: textAlignRef.value
|
|
@@ -5697,7 +5747,7 @@ const GPlaceCircle = defineSetup(function GPlaceCircle2(props, {
|
|
|
5697
5747
|
hideIcon = false
|
|
5698
5748
|
} = props;
|
|
5699
5749
|
return createDom("img", {
|
|
5700
|
-
class:
|
|
5750
|
+
class: `GPlaceCircle ${placeIcon({
|
|
5701
5751
|
hideIcon
|
|
5702
5752
|
})} ${gmapPlaceIconLayout({
|
|
5703
5753
|
textAlign: textAlignRef.value
|
|
@@ -5760,27 +5810,18 @@ const PickupPoints = defineSetup(function PickupPoints2(props, {
|
|
|
5760
5810
|
})]);
|
|
5761
5811
|
};
|
|
5762
5812
|
});
|
|
5763
|
-
const useFirstWorkflowRecomendLoading = () => {
|
|
5764
|
-
const isFirstWorkflowRecomendLoadingRef = ref(true);
|
|
5765
|
-
const completeFirstWorkflowRecomend = () => {
|
|
5766
|
-
if (!isFirstWorkflowRecomendLoadingRef.value)
|
|
5767
|
-
return;
|
|
5768
|
-
isFirstWorkflowRecomendLoadingRef.value = false;
|
|
5769
|
-
};
|
|
5770
|
-
return { isFirstWorkflowRecomendLoadingRef, completeFirstWorkflowRecomend };
|
|
5771
|
-
};
|
|
5772
5813
|
const RECOMMEND_PLACE_DRAG_LIMIT = 10;
|
|
5773
5814
|
const RECOMMEND_PLACE_LARGE_LIMIT = 100;
|
|
5774
5815
|
const RECOMMEND_PLACE_ZOOM_MIN = 13;
|
|
5775
5816
|
const DEFAULT_PLACE_NAME = "当前位置";
|
|
5776
|
-
const DEFAULT_ZOOM =
|
|
5777
|
-
const READY_ZOOM = 17;
|
|
5817
|
+
const DEFAULT_ZOOM = 17;
|
|
5778
5818
|
const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
|
|
5779
5819
|
emit,
|
|
5780
5820
|
slots
|
|
5781
5821
|
}) {
|
|
5782
5822
|
var _a, _b;
|
|
5783
5823
|
const {
|
|
5824
|
+
geoLoadingTitle,
|
|
5784
5825
|
geoDefaultPosition,
|
|
5785
5826
|
getRecomendPlace,
|
|
5786
5827
|
getDefaultCenterPlace,
|
|
@@ -5797,21 +5838,16 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5797
5838
|
readyPromise
|
|
5798
5839
|
} = useMapSupplier();
|
|
5799
5840
|
const {
|
|
5800
|
-
zoomRef
|
|
5801
|
-
setZoom
|
|
5841
|
+
zoomRef
|
|
5802
5842
|
} = useMapZoom({
|
|
5803
5843
|
mapRef,
|
|
5804
5844
|
defaultValue: DEFAULT_ZOOM
|
|
5805
5845
|
});
|
|
5806
|
-
const {
|
|
5807
|
-
isFirstWorkflowRecomendLoadingRef,
|
|
5808
|
-
completeFirstWorkflowRecomend
|
|
5809
|
-
} = useFirstWorkflowRecomendLoading();
|
|
5810
5846
|
const centerPlace = reactive({
|
|
5811
5847
|
lng: (_a = geoDefaultPosition == null ? void 0 : geoDefaultPosition[0]) != null ? _a : 0,
|
|
5812
5848
|
lat: (_b = geoDefaultPosition == null ? void 0 : geoDefaultPosition[1]) != null ? _b : 0,
|
|
5813
|
-
name:
|
|
5814
|
-
displayName:
|
|
5849
|
+
name: geoLoadingTitle,
|
|
5850
|
+
displayName: geoLoadingTitle
|
|
5815
5851
|
});
|
|
5816
5852
|
const centerPoint = computed(() => [centerPlace.lng, centerPlace.lat]);
|
|
5817
5853
|
const centerSource = {
|
|
@@ -5832,14 +5868,17 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5832
5868
|
...place
|
|
5833
5869
|
});
|
|
5834
5870
|
updatePlaceCandidates(place);
|
|
5835
|
-
await pipeDefer(setZoom)(READY_ZOOM);
|
|
5836
5871
|
};
|
|
5837
|
-
const
|
|
5872
|
+
const panToCenterByPlace = async (place) => {
|
|
5838
5873
|
centerSource.source = "api";
|
|
5874
|
+
await panTo(place2point(place));
|
|
5839
5875
|
centerPlace.lng = place.lng;
|
|
5840
5876
|
centerPlace.lat = place.lat;
|
|
5841
5877
|
centerPlace.name = place.name;
|
|
5842
5878
|
centerPlace.displayName = place.displayName;
|
|
5879
|
+
emit("changePlace", {
|
|
5880
|
+
...place
|
|
5881
|
+
});
|
|
5843
5882
|
};
|
|
5844
5883
|
const defaultCenterPlacePromise = new Promise((resolve) => {
|
|
5845
5884
|
getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
|
|
@@ -5870,9 +5909,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5870
5909
|
await setCenterPlaceByUserSpecified(place);
|
|
5871
5910
|
} else {
|
|
5872
5911
|
updatePlace(value.position);
|
|
5873
|
-
await pipeDefer(setZoom)(READY_ZOOM);
|
|
5874
5912
|
}
|
|
5875
|
-
completeFirstWorkflowRecomend();
|
|
5876
5913
|
},
|
|
5877
5914
|
onChange: (v) => emit("changeGeoLocation", v),
|
|
5878
5915
|
onError: (e) => {
|
|
@@ -5929,14 +5966,12 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5929
5966
|
},
|
|
5930
5967
|
onChange: async (place) => {
|
|
5931
5968
|
centerSource.source = "recomend";
|
|
5969
|
+
if (isPlaceEqual(place, centerPlace))
|
|
5970
|
+
panTo(place2point(place));
|
|
5932
5971
|
Object.assign(centerPlace, {
|
|
5933
5972
|
...place
|
|
5934
5973
|
});
|
|
5935
|
-
panTo(place2point(place));
|
|
5936
5974
|
emit("changeRecomandPlace", place);
|
|
5937
|
-
if (isFirstWorkflowRecomendLoadingRef.value)
|
|
5938
|
-
await pipeDefer(setZoom)(READY_ZOOM);
|
|
5939
|
-
completeFirstWorkflowRecomend();
|
|
5940
5975
|
}
|
|
5941
5976
|
});
|
|
5942
5977
|
watchEffect(() => {
|
|
@@ -5949,11 +5984,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5949
5984
|
});
|
|
5950
5985
|
return () => {
|
|
5951
5986
|
const {
|
|
5952
|
-
geoLoadingTitle,
|
|
5987
|
+
geoLoadingTitle: geoLoadingTitle2,
|
|
5953
5988
|
recomendDescription,
|
|
5954
5989
|
unavailableTitle
|
|
5955
5990
|
} = props;
|
|
5956
|
-
const title = geoLoading.value ?
|
|
5991
|
+
const title = geoLoading.value ? geoLoadingTitle2 : !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
5957
5992
|
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
|
|
5958
5993
|
return h(HeycarMap, {
|
|
5959
5994
|
"attrs": {
|
|
@@ -5975,9 +6010,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
5975
6010
|
"renderLabel": (place) => isPlaceEqual(place, centerPlace) ? void 0 : place.displayName
|
|
5976
6011
|
},
|
|
5977
6012
|
"on": {
|
|
5978
|
-
"click":
|
|
6013
|
+
"click": panToCenterByPlace
|
|
5979
6014
|
}
|
|
5980
|
-
}), geoLoading.value
|
|
6015
|
+
}), geoLoading.value ? null : h(AbsoluteAddressBox, {
|
|
5981
6016
|
"attrs": {
|
|
5982
6017
|
"title": title,
|
|
5983
6018
|
"description": description,
|
|
@@ -6036,10 +6071,10 @@ const ATaxiCar = defineSetup(function ATaxiCar2(props) {
|
|
|
6036
6071
|
const carStyle = `transform:rotate(${(_a = props.angle) != null ? _a : 0}deg)`;
|
|
6037
6072
|
if (!props.title)
|
|
6038
6073
|
return {
|
|
6039
|
-
img: `<img
|
|
6074
|
+
img: `<img class="ATaxiCar ${carIcon}" src="${imgTaxicar}" style="${carStyle}">`
|
|
6040
6075
|
};
|
|
6041
6076
|
const content = (hide$1) => `
|
|
6042
|
-
<div class="${pointLayout}">
|
|
6077
|
+
<div class="ATaxiCar ${pointLayout}">
|
|
6043
6078
|
<div class="${pointSingleInfoBox} ${hide({
|
|
6044
6079
|
hide: !hide$1
|
|
6045
6080
|
})}">
|
|
@@ -6081,13 +6116,13 @@ const GTaxiCar = defineSetup(function GTaxiCar2(props) {
|
|
|
6081
6116
|
if (!props.title)
|
|
6082
6117
|
return {
|
|
6083
6118
|
img: createDom("img", {
|
|
6084
|
-
class: carIcon
|
|
6119
|
+
class: `GTaxiCar ${carIcon}`,
|
|
6085
6120
|
src: imgTaxicar,
|
|
6086
6121
|
style: carStyle
|
|
6087
6122
|
})
|
|
6088
6123
|
};
|
|
6089
6124
|
const content = (hide$1) => createDom("div", {
|
|
6090
|
-
class: pointLayout
|
|
6125
|
+
class: `GTaxiCar ${pointLayout}`
|
|
6091
6126
|
}, `
|
|
6092
6127
|
<div class="${pointSingleInfoBox} ${hide({
|
|
6093
6128
|
hide: !hide$1
|
|
@@ -6312,8 +6347,8 @@ const WaveCircle_css_ts_vanilla = "";
|
|
|
6312
6347
|
var secondCircle = "rrvp0y3";
|
|
6313
6348
|
var waveCircle = "rrvp0y2";
|
|
6314
6349
|
const AWaveCircle = defineSetup(function AWaveCircle2(props) {
|
|
6315
|
-
const contentRef = computed(() => `<img
|
|
6316
|
-
const contentAnotherRef = computed(() => `<img
|
|
6350
|
+
const contentRef = computed(() => `<img class="AWaveCircle ${waveCircle}" src="${imgWaveCircle}">`);
|
|
6351
|
+
const contentAnotherRef = computed(() => `<img class="AWaveCircle ${waveCircle} ${secondCircle}" src="${imgWaveCircle}">`);
|
|
6317
6352
|
return () => h("div", [h(AmapMarker, {
|
|
6318
6353
|
"attrs": {
|
|
6319
6354
|
"position": props.position,
|
|
@@ -6330,11 +6365,11 @@ const AWaveCircle = defineSetup(function AWaveCircle2(props) {
|
|
|
6330
6365
|
});
|
|
6331
6366
|
const GWaveCircle = defineSetup(function GWaveCircle2(props) {
|
|
6332
6367
|
const contentRef = computed(() => createDom("img", {
|
|
6333
|
-
class: waveCircle
|
|
6368
|
+
class: `GWaveCircle ${waveCircle}`,
|
|
6334
6369
|
src: imgWaveCircle
|
|
6335
6370
|
}));
|
|
6336
6371
|
const contentAnotherRef = computed(() => createDom("img", {
|
|
6337
|
-
class:
|
|
6372
|
+
class: `GWaveCircle ${waveCircle} ${secondCircle}`,
|
|
6338
6373
|
src: imgWaveCircle
|
|
6339
6374
|
}));
|
|
6340
6375
|
return () => {
|