@heycar/heycars-map 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -11
- package/dist/index.js +25 -11
- package/dist/style.css +4 -0
- package/dist/utils/transform.d.ts +5 -0
- package/package.json +1 -1
- package/todo.md +9 -0
package/dist/index.cjs
CHANGED
|
@@ -884,8 +884,8 @@ createComparator(function() {
|
|
|
884
884
|
createComparator(createCircularEqualCreator());
|
|
885
885
|
createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
|
886
886
|
const vec2lnglat = ([lng, lat]) => ({
|
|
887
|
-
lng,
|
|
888
|
-
lat
|
|
887
|
+
lng: Number(lng),
|
|
888
|
+
lat: Number(lat)
|
|
889
889
|
});
|
|
890
890
|
const decodeAsterisk = (encodedValue) => {
|
|
891
891
|
const result = [];
|
|
@@ -912,7 +912,7 @@ const language2vectorMapForeign = (lang) => {
|
|
|
912
912
|
return "style_zh_cn";
|
|
913
913
|
}
|
|
914
914
|
};
|
|
915
|
-
const place2point = (place) => [place.lng, place.lat];
|
|
915
|
+
const place2point = (place) => [Number(place.lng), Number(place.lat)];
|
|
916
916
|
const pipeAsync = (fn) => (...args) => {
|
|
917
917
|
Promise.resolve().then(() => fn == null ? void 0 : fn(...args));
|
|
918
918
|
};
|
|
@@ -943,6 +943,15 @@ const isPlaceEqual = (p1, p2) => {
|
|
|
943
943
|
const isPointEqual = (p1, p2) => {
|
|
944
944
|
return p1[0] === (p2 == null ? void 0 : p2[0]) && p1[1] === (p2 == null ? void 0 : p2[1]);
|
|
945
945
|
};
|
|
946
|
+
const toPlaceType = (maybePlace) => {
|
|
947
|
+
const lng = Number(maybePlace.lng);
|
|
948
|
+
if (isNaN(lng))
|
|
949
|
+
throw new Error("MyError: expect lng to be number");
|
|
950
|
+
const lat = Number(maybePlace.lat);
|
|
951
|
+
if (isNaN(lat))
|
|
952
|
+
throw new Error("MyError: expect lat to be number");
|
|
953
|
+
return { lng, lat, name: maybePlace.name };
|
|
954
|
+
};
|
|
946
955
|
const deepCompareEqualsForMaps = createComparator((deepEqual) => (a, b) => {
|
|
947
956
|
if (isLatLngLiteral(a) || isLatLngLiteral(b)) {
|
|
948
957
|
return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));
|
|
@@ -2213,12 +2222,12 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2213
2222
|
"attrs": {
|
|
2214
2223
|
"mapRef": setMap,
|
|
2215
2224
|
"mapId": gmapId,
|
|
2216
|
-
"center": center ? vec2lnglat(center
|
|
2225
|
+
"center": center ? vec2lnglat(center) : void 0,
|
|
2217
2226
|
"zoom": zoom,
|
|
2218
2227
|
"disableDefaultUI": true,
|
|
2219
2228
|
"clickableIcons": false,
|
|
2220
2229
|
"disableDoubleClickZoom": touchEnable,
|
|
2221
|
-
"gestureHandling": touchEnable ? "
|
|
2230
|
+
"gestureHandling": touchEnable ? "greedy" : "none",
|
|
2222
2231
|
"keyboardShortcuts": touchEnable,
|
|
2223
2232
|
"touchZoomCenter": touchZoomCenter
|
|
2224
2233
|
},
|
|
@@ -3948,8 +3957,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3948
3957
|
centerSource.source = "api";
|
|
3949
3958
|
updatePlace(point);
|
|
3950
3959
|
};
|
|
3951
|
-
const setCenterPlaceByUserSpecified = async (
|
|
3960
|
+
const setCenterPlaceByUserSpecified = async (input) => {
|
|
3952
3961
|
centerSource.source = "api";
|
|
3962
|
+
const place = toPlaceType(input);
|
|
3953
3963
|
centerPlace.lng = place.lng;
|
|
3954
3964
|
centerPlace.lat = place.lat;
|
|
3955
3965
|
centerPlace.name = place.name;
|
|
@@ -5011,10 +5021,12 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
5011
5021
|
const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
|
|
5012
5022
|
return () => {
|
|
5013
5023
|
const {
|
|
5014
|
-
from,
|
|
5015
|
-
to
|
|
5024
|
+
from: inputFrom,
|
|
5025
|
+
to: inputTo
|
|
5016
5026
|
} = props;
|
|
5017
|
-
const isReady = isPlace(
|
|
5027
|
+
const isReady = isPlace(inputFrom) && isPlace(inputTo);
|
|
5028
|
+
const from = toPlaceType(inputFrom);
|
|
5029
|
+
const to = toPlaceType(inputTo);
|
|
5018
5030
|
const center = isReady ? place2point(from) : [...BEIJIN_POINT];
|
|
5019
5031
|
return Vue.h(HeycarMap, {
|
|
5020
5032
|
"attrs": {
|
|
@@ -5078,12 +5090,14 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5078
5090
|
return () => {
|
|
5079
5091
|
const {
|
|
5080
5092
|
driverStatus,
|
|
5081
|
-
from,
|
|
5082
|
-
to,
|
|
5093
|
+
from: inputFrom,
|
|
5094
|
+
to: inputTo,
|
|
5083
5095
|
dispatchingTitle,
|
|
5084
5096
|
bookDispatchingTitle,
|
|
5085
5097
|
driverArrivedTitle
|
|
5086
5098
|
} = props;
|
|
5099
|
+
const from = toPlaceType(inputFrom);
|
|
5100
|
+
const to = toPlaceType(inputTo);
|
|
5087
5101
|
const carPosition = carPositionRef.value;
|
|
5088
5102
|
const carAngle = carAngleRef.value;
|
|
5089
5103
|
const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
|
package/dist/index.js
CHANGED
|
@@ -882,8 +882,8 @@ createComparator(function() {
|
|
|
882
882
|
createComparator(createCircularEqualCreator());
|
|
883
883
|
createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
|
884
884
|
const vec2lnglat = ([lng, lat]) => ({
|
|
885
|
-
lng,
|
|
886
|
-
lat
|
|
885
|
+
lng: Number(lng),
|
|
886
|
+
lat: Number(lat)
|
|
887
887
|
});
|
|
888
888
|
const decodeAsterisk = (encodedValue) => {
|
|
889
889
|
const result = [];
|
|
@@ -910,7 +910,7 @@ const language2vectorMapForeign = (lang) => {
|
|
|
910
910
|
return "style_zh_cn";
|
|
911
911
|
}
|
|
912
912
|
};
|
|
913
|
-
const place2point = (place) => [place.lng, place.lat];
|
|
913
|
+
const place2point = (place) => [Number(place.lng), Number(place.lat)];
|
|
914
914
|
const pipeAsync = (fn) => (...args) => {
|
|
915
915
|
Promise.resolve().then(() => fn == null ? void 0 : fn(...args));
|
|
916
916
|
};
|
|
@@ -941,6 +941,15 @@ const isPlaceEqual = (p1, p2) => {
|
|
|
941
941
|
const isPointEqual = (p1, p2) => {
|
|
942
942
|
return p1[0] === (p2 == null ? void 0 : p2[0]) && p1[1] === (p2 == null ? void 0 : p2[1]);
|
|
943
943
|
};
|
|
944
|
+
const toPlaceType = (maybePlace) => {
|
|
945
|
+
const lng = Number(maybePlace.lng);
|
|
946
|
+
if (isNaN(lng))
|
|
947
|
+
throw new Error("MyError: expect lng to be number");
|
|
948
|
+
const lat = Number(maybePlace.lat);
|
|
949
|
+
if (isNaN(lat))
|
|
950
|
+
throw new Error("MyError: expect lat to be number");
|
|
951
|
+
return { lng, lat, name: maybePlace.name };
|
|
952
|
+
};
|
|
944
953
|
const deepCompareEqualsForMaps = createComparator((deepEqual) => (a, b) => {
|
|
945
954
|
if (isLatLngLiteral(a) || isLatLngLiteral(b)) {
|
|
946
955
|
return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));
|
|
@@ -2211,12 +2220,12 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2211
2220
|
"attrs": {
|
|
2212
2221
|
"mapRef": setMap,
|
|
2213
2222
|
"mapId": gmapId,
|
|
2214
|
-
"center": center ? vec2lnglat(center
|
|
2223
|
+
"center": center ? vec2lnglat(center) : void 0,
|
|
2215
2224
|
"zoom": zoom,
|
|
2216
2225
|
"disableDefaultUI": true,
|
|
2217
2226
|
"clickableIcons": false,
|
|
2218
2227
|
"disableDoubleClickZoom": touchEnable,
|
|
2219
|
-
"gestureHandling": touchEnable ? "
|
|
2228
|
+
"gestureHandling": touchEnable ? "greedy" : "none",
|
|
2220
2229
|
"keyboardShortcuts": touchEnable,
|
|
2221
2230
|
"touchZoomCenter": touchZoomCenter
|
|
2222
2231
|
},
|
|
@@ -3946,8 +3955,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3946
3955
|
centerSource.source = "api";
|
|
3947
3956
|
updatePlace(point);
|
|
3948
3957
|
};
|
|
3949
|
-
const setCenterPlaceByUserSpecified = async (
|
|
3958
|
+
const setCenterPlaceByUserSpecified = async (input) => {
|
|
3950
3959
|
centerSource.source = "api";
|
|
3960
|
+
const place = toPlaceType(input);
|
|
3951
3961
|
centerPlace.lng = place.lng;
|
|
3952
3962
|
centerPlace.lat = place.lat;
|
|
3953
3963
|
centerPlace.name = place.name;
|
|
@@ -5009,10 +5019,12 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
5009
5019
|
const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
|
|
5010
5020
|
return () => {
|
|
5011
5021
|
const {
|
|
5012
|
-
from,
|
|
5013
|
-
to
|
|
5022
|
+
from: inputFrom,
|
|
5023
|
+
to: inputTo
|
|
5014
5024
|
} = props;
|
|
5015
|
-
const isReady = isPlace(
|
|
5025
|
+
const isReady = isPlace(inputFrom) && isPlace(inputTo);
|
|
5026
|
+
const from = toPlaceType(inputFrom);
|
|
5027
|
+
const to = toPlaceType(inputTo);
|
|
5016
5028
|
const center = isReady ? place2point(from) : [...BEIJIN_POINT];
|
|
5017
5029
|
return h(HeycarMap, {
|
|
5018
5030
|
"attrs": {
|
|
@@ -5076,12 +5088,14 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5076
5088
|
return () => {
|
|
5077
5089
|
const {
|
|
5078
5090
|
driverStatus,
|
|
5079
|
-
from,
|
|
5080
|
-
to,
|
|
5091
|
+
from: inputFrom,
|
|
5092
|
+
to: inputTo,
|
|
5081
5093
|
dispatchingTitle,
|
|
5082
5094
|
bookDispatchingTitle,
|
|
5083
5095
|
driverArrivedTitle
|
|
5084
5096
|
} = props;
|
|
5097
|
+
const from = toPlaceType(inputFrom);
|
|
5098
|
+
const to = toPlaceType(inputTo);
|
|
5085
5099
|
const carPosition = carPositionRef.value;
|
|
5086
5100
|
const carAngle = carAngleRef.value;
|
|
5087
5101
|
const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
|
package/dist/style.css
CHANGED
|
@@ -126,6 +126,10 @@ a[title*="Google"]>div>img[alt="Google"], .gmnoprint {
|
|
|
126
126
|
}
|
|
127
127
|
._7anfuo0 [class*="marker-view"] {
|
|
128
128
|
will-change: unset !important;
|
|
129
|
+
}
|
|
130
|
+
._7anfuo0 a, ._7anfuo0 img, ._7anfuo0 div, ._7anfuo0 button {
|
|
131
|
+
-webkit-tap-highlight-color: transparent;
|
|
132
|
+
outline: none;
|
|
129
133
|
}._4a4ovk0 {
|
|
130
134
|
margin-bottom: -0.4vw;
|
|
131
135
|
display: flex;
|
|
@@ -16,3 +16,8 @@ export declare const pipeDefer: <P extends any[], R>(fn: (...args: P) => R) => (
|
|
|
16
16
|
export declare const pipeOnlyLastEffect: <P extends any[], R>(fn: (...arg: P) => Promise<R>) => (...args: P) => Promise<R>;
|
|
17
17
|
export declare const isPlaceEqual: (p1: Place, p2?: Place) => boolean;
|
|
18
18
|
export declare const isPointEqual: (p1: Point, p2?: Point) => boolean;
|
|
19
|
+
export declare const toPlaceType: (maybePlace: {
|
|
20
|
+
name: string;
|
|
21
|
+
lng: string | number;
|
|
22
|
+
lat: string | number;
|
|
23
|
+
}) => Place;
|
package/package.json
CHANGED