@heycar/heycars-map 0.5.4 → 0.5.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/Demo/DemoBusinessTaxiService.d.ts +4 -1
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +3 -0
- package/dist/index.cjs +92 -44
- package/dist/index.js +92 -44
- package/dist/utils/helper.d.ts +2 -0
- package/package.json +1 -1
- package/todo.md +7 -4
|
@@ -2052,5 +2052,8 @@ export declare const DemoBusinessTaxiService: import("vue").DefineComponent<Read
|
|
|
2052
2052
|
status: DriverStatus;
|
|
2053
2053
|
contentHeight: number;
|
|
2054
2054
|
}, {}, {
|
|
2055
|
-
getDriverPosition(): Promise<
|
|
2055
|
+
getDriverPosition(): Promise<{
|
|
2056
|
+
position: Point;
|
|
2057
|
+
angle: number;
|
|
2058
|
+
}>;
|
|
2056
2059
|
}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<Readonly<{}>>>, {}>;
|
|
@@ -18,6 +18,9 @@ export type BusinessTaxiServiceMapProps = Omit<HeycarMapProps, "center" | "zoom"
|
|
|
18
18
|
distance: number;
|
|
19
19
|
duration: number;
|
|
20
20
|
}) => string;
|
|
21
|
-
getDriverPosition: () => Promise<
|
|
21
|
+
getDriverPosition: () => Promise<{
|
|
22
|
+
position: Point;
|
|
23
|
+
angle?: number;
|
|
24
|
+
}>;
|
|
22
25
|
};
|
|
23
26
|
export declare const BusinessTaxiServiceMap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd", BusinessTaxiServiceMapProps, {} | {}>;
|
|
@@ -15,6 +15,7 @@ export declare const SectionConfirmed: import("vue").DefineComponent<import("vue
|
|
|
15
15
|
type SectionDriverStartServiceProps = Required<MROP> & {
|
|
16
16
|
passengerPosition?: Point;
|
|
17
17
|
carPosition?: Point;
|
|
18
|
+
carAngle?: number;
|
|
18
19
|
from: Place;
|
|
19
20
|
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
20
21
|
};
|
|
@@ -28,6 +29,7 @@ export declare const SectionBookDispatched: import("vue").DefineComponent<import
|
|
|
28
29
|
type SectionDriverArrivedProps = Required<MROP> & {
|
|
29
30
|
from: Place;
|
|
30
31
|
carPosition?: Point;
|
|
32
|
+
carAngle?: number;
|
|
31
33
|
passengerPosition?: Point;
|
|
32
34
|
title: string;
|
|
33
35
|
};
|
|
@@ -35,6 +37,7 @@ export declare const SectionDriverArrived: import("vue").DefineComponent<import(
|
|
|
35
37
|
type SectionInServiceProps = Required<MROP> & {
|
|
36
38
|
to: Place;
|
|
37
39
|
carPosition?: Point;
|
|
40
|
+
carAngle?: number;
|
|
38
41
|
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
39
42
|
};
|
|
40
43
|
export declare const SectionInService: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<SectionInServiceProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<SectionInServiceProps, Required<SectionInServiceProps>>, never, SectionInServiceProps, {} | {}>;
|
package/dist/index.cjs
CHANGED
|
@@ -2425,7 +2425,8 @@ const amapComputeHeading = (from, to, map) => {
|
|
|
2425
2425
|
const { x: xFrom, y: yFrom } = map.lngLatToContainer(from);
|
|
2426
2426
|
const { x: xTo, y: yTo } = map.lngLatToContainer(to);
|
|
2427
2427
|
const theta = Math.atan2(yFrom - yTo, xTo - xFrom);
|
|
2428
|
-
|
|
2428
|
+
const signedAngle = (Math.PI / 2 - theta) / Math.PI * 180;
|
|
2429
|
+
return signedAngle < 0 ? 360 + signedAngle : signedAngle;
|
|
2429
2430
|
};
|
|
2430
2431
|
const useAmapAngle = (props) => {
|
|
2431
2432
|
return Vue.computed(() => {
|
|
@@ -2955,6 +2956,16 @@ const isPlace = (place) => {
|
|
|
2955
2956
|
return place.lng !== void 0 && place.lat !== void 0;
|
|
2956
2957
|
};
|
|
2957
2958
|
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
2959
|
+
const assertPoint = (point) => {
|
|
2960
|
+
if (Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number")
|
|
2961
|
+
return;
|
|
2962
|
+
throw new Error(`Assertion Error: expect type [number, number], actual is ${point}`);
|
|
2963
|
+
};
|
|
2964
|
+
const assertAngle = (angle) => {
|
|
2965
|
+
if (typeof angle === "number" || typeof angle === "undefined")
|
|
2966
|
+
return;
|
|
2967
|
+
throw new Error(`Assertion Error: expect type number | undefined, actual is ${angle}`);
|
|
2968
|
+
};
|
|
2958
2969
|
class SingleGeoWatch {
|
|
2959
2970
|
constructor(option) {
|
|
2960
2971
|
__publicField(this, "id", 0);
|
|
@@ -3858,7 +3869,8 @@ const DEFAULT_PLACE_NAME = "当前位置";
|
|
|
3858
3869
|
const DEFAULT_ZOOM = 8;
|
|
3859
3870
|
const READY_ZOOM = 17;
|
|
3860
3871
|
const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
|
|
3861
|
-
emit
|
|
3872
|
+
emit,
|
|
3873
|
+
slots
|
|
3862
3874
|
}) {
|
|
3863
3875
|
var _a, _b;
|
|
3864
3876
|
const {
|
|
@@ -4041,7 +4053,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
4041
4053
|
"center": centerPoint.value,
|
|
4042
4054
|
"zoom": zoomRef.value,
|
|
4043
4055
|
"touchZoomCenter": true,
|
|
4044
|
-
"mapRef": setMap
|
|
4056
|
+
"mapRef": setMap,
|
|
4057
|
+
"fallback": slots.fallback,
|
|
4058
|
+
"loading": slots.loading
|
|
4045
4059
|
}
|
|
4046
4060
|
}, [!geoLoading.value && !geoError.value && Vue.h(PassengerCircle, {
|
|
4047
4061
|
"attrs": {
|
|
@@ -4535,6 +4549,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
4535
4549
|
const {
|
|
4536
4550
|
from: fromPlace,
|
|
4537
4551
|
carPosition,
|
|
4552
|
+
carAngle,
|
|
4538
4553
|
passengerPosition,
|
|
4539
4554
|
renderTitle,
|
|
4540
4555
|
registerOverlay
|
|
@@ -4566,31 +4581,37 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
4566
4581
|
"to": from,
|
|
4567
4582
|
"render": ({
|
|
4568
4583
|
path,
|
|
4584
|
+
angle,
|
|
4569
4585
|
distance,
|
|
4570
4586
|
duration
|
|
4571
|
-
}) =>
|
|
4572
|
-
"
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
"
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4587
|
+
}) => {
|
|
4588
|
+
spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
|
|
4589
|
+
return [Vue.h(DrivingLine, {
|
|
4590
|
+
"attrs": {
|
|
4591
|
+
"path": path
|
|
4592
|
+
}
|
|
4593
|
+
}), Vue.h(TaxiCar, {
|
|
4594
|
+
"attrs": {
|
|
4595
|
+
"position": carPosition,
|
|
4596
|
+
"angle": angle,
|
|
4597
|
+
"title": renderTitle({
|
|
4598
|
+
distance,
|
|
4599
|
+
duration
|
|
4600
|
+
}),
|
|
4601
|
+
"registerOverlay": registerOverlay
|
|
4602
|
+
}
|
|
4603
|
+
}), Vue.h(KeyedFitView, {
|
|
4604
|
+
"attrs": {
|
|
4605
|
+
"registerOverlay": registerOverlay,
|
|
4606
|
+
"fitViewKey": JSON.stringify(carPosition)
|
|
4607
|
+
}
|
|
4608
|
+
})];
|
|
4609
|
+
}
|
|
4590
4610
|
}
|
|
4591
4611
|
}) : [Vue.h(TaxiCar, {
|
|
4592
4612
|
"attrs": {
|
|
4593
4613
|
"position": carPosition,
|
|
4614
|
+
"angle": carAngle,
|
|
4594
4615
|
"title": renderTitle({
|
|
4595
4616
|
distance: carDistance,
|
|
4596
4617
|
duration: carDurationWithinMinDistance(carDistance)
|
|
@@ -4704,6 +4725,7 @@ const SectionDriverArrived = defineSetup(function SectionDriverArrived2(props) {
|
|
|
4704
4725
|
const {
|
|
4705
4726
|
from: fromPlace,
|
|
4706
4727
|
carPosition,
|
|
4728
|
+
carAngle,
|
|
4707
4729
|
passengerPosition,
|
|
4708
4730
|
title,
|
|
4709
4731
|
registerOverlay
|
|
@@ -4731,6 +4753,7 @@ const SectionDriverArrived = defineSetup(function SectionDriverArrived2(props) {
|
|
|
4731
4753
|
}), !!carPosition && [Vue.h(TaxiCar, {
|
|
4732
4754
|
"attrs": {
|
|
4733
4755
|
"position": carPosition,
|
|
4756
|
+
"angle": carAngle,
|
|
4734
4757
|
"title": title,
|
|
4735
4758
|
"registerOverlay": registerOverlay
|
|
4736
4759
|
}
|
|
@@ -4763,6 +4786,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
4763
4786
|
const {
|
|
4764
4787
|
to: toPlace,
|
|
4765
4788
|
carPosition,
|
|
4789
|
+
carAngle,
|
|
4766
4790
|
renderTitle,
|
|
4767
4791
|
registerOverlay
|
|
4768
4792
|
} = props;
|
|
@@ -4777,31 +4801,37 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
4777
4801
|
"to": to,
|
|
4778
4802
|
"render": ({
|
|
4779
4803
|
path,
|
|
4804
|
+
angle,
|
|
4780
4805
|
distance,
|
|
4781
4806
|
duration
|
|
4782
|
-
}) =>
|
|
4783
|
-
"
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
"
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4807
|
+
}) => {
|
|
4808
|
+
spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
|
|
4809
|
+
return [Vue.h(DrivingLine, {
|
|
4810
|
+
"attrs": {
|
|
4811
|
+
"path": path
|
|
4812
|
+
}
|
|
4813
|
+
}), Vue.h(TaxiCar, {
|
|
4814
|
+
"attrs": {
|
|
4815
|
+
"position": carPosition,
|
|
4816
|
+
"angle": angle,
|
|
4817
|
+
"title": renderTitle({
|
|
4818
|
+
distance,
|
|
4819
|
+
duration
|
|
4820
|
+
}),
|
|
4821
|
+
"registerOverlay": registerOverlay
|
|
4822
|
+
}
|
|
4823
|
+
}), Vue.h(KeyedFitView, {
|
|
4824
|
+
"attrs": {
|
|
4825
|
+
"registerOverlay": registerOverlay,
|
|
4826
|
+
"fitViewKey": JSON.stringify(carPosition)
|
|
4827
|
+
}
|
|
4828
|
+
})];
|
|
4829
|
+
}
|
|
4801
4830
|
}
|
|
4802
4831
|
}) : [Vue.h(TaxiCar, {
|
|
4803
4832
|
"attrs": {
|
|
4804
4833
|
"position": carPosition,
|
|
4834
|
+
"angle": carAngle,
|
|
4805
4835
|
"title": renderTitle({
|
|
4806
4836
|
distance: carDistance,
|
|
4807
4837
|
duration: carDurationWithinMinDistance(carDistance)
|
|
@@ -4980,12 +5010,26 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4980
5010
|
geoError
|
|
4981
5011
|
} = useGeoLocation();
|
|
4982
5012
|
const carPositionRef = Vue.ref();
|
|
5013
|
+
const carAngleRef = Vue.ref();
|
|
5014
|
+
const {
|
|
5015
|
+
toGcj02
|
|
5016
|
+
} = useMapGCJ02();
|
|
4983
5017
|
Vue.watch(() => props.driverStatus, (status, _, onCleanup) => {
|
|
4984
5018
|
if (!STATUS_NEED_CAR_POSITION.includes(status))
|
|
4985
5019
|
return;
|
|
4986
|
-
const
|
|
4987
|
-
getDriverPosition().then((
|
|
4988
|
-
|
|
5020
|
+
const update = () => {
|
|
5021
|
+
getDriverPosition().then(async ({
|
|
5022
|
+
position,
|
|
5023
|
+
angle
|
|
5024
|
+
}) => {
|
|
5025
|
+
assertPoint(position);
|
|
5026
|
+
assertAngle(angle);
|
|
5027
|
+
carPositionRef.value = position ? await toGcj02(position) : void 0;
|
|
5028
|
+
carAngleRef.value = angle;
|
|
5029
|
+
});
|
|
5030
|
+
};
|
|
5031
|
+
const timer = setInterval(update, interval);
|
|
5032
|
+
update();
|
|
4989
5033
|
onCleanup(() => clearInterval(timer));
|
|
4990
5034
|
}, {
|
|
4991
5035
|
immediate: true
|
|
@@ -5000,6 +5044,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5000
5044
|
driverArrivedTitle
|
|
5001
5045
|
} = props;
|
|
5002
5046
|
const carPosition = carPositionRef.value;
|
|
5047
|
+
const carAngle = carAngleRef.value;
|
|
5003
5048
|
const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
|
|
5004
5049
|
const passengerPosition = geoError.value ? void 0 : geoPosition.value;
|
|
5005
5050
|
return Vue.h(HeycarMap, {
|
|
@@ -5035,6 +5080,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5035
5080
|
"attrs": {
|
|
5036
5081
|
"from": from,
|
|
5037
5082
|
"carPosition": carPosition,
|
|
5083
|
+
"carAngle": carAngle,
|
|
5038
5084
|
"passengerPosition": passengerPosition,
|
|
5039
5085
|
"renderTitle": renderStartSerivceTitle,
|
|
5040
5086
|
"registerOverlay": registerOverlay
|
|
@@ -5050,6 +5096,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5050
5096
|
"attrs": {
|
|
5051
5097
|
"to": to,
|
|
5052
5098
|
"carPosition": carPosition,
|
|
5099
|
+
"carAngle": carAngle,
|
|
5053
5100
|
"renderTitle": renderInServiceTitle,
|
|
5054
5101
|
"registerOverlay": registerOverlay
|
|
5055
5102
|
}
|
|
@@ -5057,6 +5104,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5057
5104
|
"attrs": {
|
|
5058
5105
|
"from": from,
|
|
5059
5106
|
"carPosition": carPosition,
|
|
5107
|
+
"carAngle": carAngle,
|
|
5060
5108
|
"passengerPosition": passengerPosition,
|
|
5061
5109
|
"title": driverArrivedTitle,
|
|
5062
5110
|
"registerOverlay": registerOverlay
|
package/dist/index.js
CHANGED
|
@@ -2423,7 +2423,8 @@ const amapComputeHeading = (from, to, map) => {
|
|
|
2423
2423
|
const { x: xFrom, y: yFrom } = map.lngLatToContainer(from);
|
|
2424
2424
|
const { x: xTo, y: yTo } = map.lngLatToContainer(to);
|
|
2425
2425
|
const theta = Math.atan2(yFrom - yTo, xTo - xFrom);
|
|
2426
|
-
|
|
2426
|
+
const signedAngle = (Math.PI / 2 - theta) / Math.PI * 180;
|
|
2427
|
+
return signedAngle < 0 ? 360 + signedAngle : signedAngle;
|
|
2427
2428
|
};
|
|
2428
2429
|
const useAmapAngle = (props) => {
|
|
2429
2430
|
return computed(() => {
|
|
@@ -2953,6 +2954,16 @@ const isPlace = (place) => {
|
|
|
2953
2954
|
return place.lng !== void 0 && place.lat !== void 0;
|
|
2954
2955
|
};
|
|
2955
2956
|
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
2957
|
+
const assertPoint = (point) => {
|
|
2958
|
+
if (Array.isArray(point) && point.length === 2 && typeof point[0] === "number" && typeof point[1] === "number")
|
|
2959
|
+
return;
|
|
2960
|
+
throw new Error(`Assertion Error: expect type [number, number], actual is ${point}`);
|
|
2961
|
+
};
|
|
2962
|
+
const assertAngle = (angle) => {
|
|
2963
|
+
if (typeof angle === "number" || typeof angle === "undefined")
|
|
2964
|
+
return;
|
|
2965
|
+
throw new Error(`Assertion Error: expect type number | undefined, actual is ${angle}`);
|
|
2966
|
+
};
|
|
2956
2967
|
class SingleGeoWatch {
|
|
2957
2968
|
constructor(option) {
|
|
2958
2969
|
__publicField(this, "id", 0);
|
|
@@ -3856,7 +3867,8 @@ const DEFAULT_PLACE_NAME = "当前位置";
|
|
|
3856
3867
|
const DEFAULT_ZOOM = 8;
|
|
3857
3868
|
const READY_ZOOM = 17;
|
|
3858
3869
|
const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
|
|
3859
|
-
emit
|
|
3870
|
+
emit,
|
|
3871
|
+
slots
|
|
3860
3872
|
}) {
|
|
3861
3873
|
var _a, _b;
|
|
3862
3874
|
const {
|
|
@@ -4039,7 +4051,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
4039
4051
|
"center": centerPoint.value,
|
|
4040
4052
|
"zoom": zoomRef.value,
|
|
4041
4053
|
"touchZoomCenter": true,
|
|
4042
|
-
"mapRef": setMap
|
|
4054
|
+
"mapRef": setMap,
|
|
4055
|
+
"fallback": slots.fallback,
|
|
4056
|
+
"loading": slots.loading
|
|
4043
4057
|
}
|
|
4044
4058
|
}, [!geoLoading.value && !geoError.value && h(PassengerCircle, {
|
|
4045
4059
|
"attrs": {
|
|
@@ -4533,6 +4547,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
4533
4547
|
const {
|
|
4534
4548
|
from: fromPlace,
|
|
4535
4549
|
carPosition,
|
|
4550
|
+
carAngle,
|
|
4536
4551
|
passengerPosition,
|
|
4537
4552
|
renderTitle,
|
|
4538
4553
|
registerOverlay
|
|
@@ -4564,31 +4579,37 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
4564
4579
|
"to": from,
|
|
4565
4580
|
"render": ({
|
|
4566
4581
|
path,
|
|
4582
|
+
angle,
|
|
4567
4583
|
distance,
|
|
4568
4584
|
duration
|
|
4569
|
-
}) =>
|
|
4570
|
-
"
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
"
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4585
|
+
}) => {
|
|
4586
|
+
spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
|
|
4587
|
+
return [h(DrivingLine, {
|
|
4588
|
+
"attrs": {
|
|
4589
|
+
"path": path
|
|
4590
|
+
}
|
|
4591
|
+
}), h(TaxiCar, {
|
|
4592
|
+
"attrs": {
|
|
4593
|
+
"position": carPosition,
|
|
4594
|
+
"angle": angle,
|
|
4595
|
+
"title": renderTitle({
|
|
4596
|
+
distance,
|
|
4597
|
+
duration
|
|
4598
|
+
}),
|
|
4599
|
+
"registerOverlay": registerOverlay
|
|
4600
|
+
}
|
|
4601
|
+
}), h(KeyedFitView, {
|
|
4602
|
+
"attrs": {
|
|
4603
|
+
"registerOverlay": registerOverlay,
|
|
4604
|
+
"fitViewKey": JSON.stringify(carPosition)
|
|
4605
|
+
}
|
|
4606
|
+
})];
|
|
4607
|
+
}
|
|
4588
4608
|
}
|
|
4589
4609
|
}) : [h(TaxiCar, {
|
|
4590
4610
|
"attrs": {
|
|
4591
4611
|
"position": carPosition,
|
|
4612
|
+
"angle": carAngle,
|
|
4592
4613
|
"title": renderTitle({
|
|
4593
4614
|
distance: carDistance,
|
|
4594
4615
|
duration: carDurationWithinMinDistance(carDistance)
|
|
@@ -4702,6 +4723,7 @@ const SectionDriverArrived = defineSetup(function SectionDriverArrived2(props) {
|
|
|
4702
4723
|
const {
|
|
4703
4724
|
from: fromPlace,
|
|
4704
4725
|
carPosition,
|
|
4726
|
+
carAngle,
|
|
4705
4727
|
passengerPosition,
|
|
4706
4728
|
title,
|
|
4707
4729
|
registerOverlay
|
|
@@ -4729,6 +4751,7 @@ const SectionDriverArrived = defineSetup(function SectionDriverArrived2(props) {
|
|
|
4729
4751
|
}), !!carPosition && [h(TaxiCar, {
|
|
4730
4752
|
"attrs": {
|
|
4731
4753
|
"position": carPosition,
|
|
4754
|
+
"angle": carAngle,
|
|
4732
4755
|
"title": title,
|
|
4733
4756
|
"registerOverlay": registerOverlay
|
|
4734
4757
|
}
|
|
@@ -4761,6 +4784,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
4761
4784
|
const {
|
|
4762
4785
|
to: toPlace,
|
|
4763
4786
|
carPosition,
|
|
4787
|
+
carAngle,
|
|
4764
4788
|
renderTitle,
|
|
4765
4789
|
registerOverlay
|
|
4766
4790
|
} = props;
|
|
@@ -4775,31 +4799,37 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
4775
4799
|
"to": to,
|
|
4776
4800
|
"render": ({
|
|
4777
4801
|
path,
|
|
4802
|
+
angle,
|
|
4778
4803
|
distance,
|
|
4779
4804
|
duration
|
|
4780
|
-
}) =>
|
|
4781
|
-
"
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
"
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4805
|
+
}) => {
|
|
4806
|
+
spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
|
|
4807
|
+
return [h(DrivingLine, {
|
|
4808
|
+
"attrs": {
|
|
4809
|
+
"path": path
|
|
4810
|
+
}
|
|
4811
|
+
}), h(TaxiCar, {
|
|
4812
|
+
"attrs": {
|
|
4813
|
+
"position": carPosition,
|
|
4814
|
+
"angle": angle,
|
|
4815
|
+
"title": renderTitle({
|
|
4816
|
+
distance,
|
|
4817
|
+
duration
|
|
4818
|
+
}),
|
|
4819
|
+
"registerOverlay": registerOverlay
|
|
4820
|
+
}
|
|
4821
|
+
}), h(KeyedFitView, {
|
|
4822
|
+
"attrs": {
|
|
4823
|
+
"registerOverlay": registerOverlay,
|
|
4824
|
+
"fitViewKey": JSON.stringify(carPosition)
|
|
4825
|
+
}
|
|
4826
|
+
})];
|
|
4827
|
+
}
|
|
4799
4828
|
}
|
|
4800
4829
|
}) : [h(TaxiCar, {
|
|
4801
4830
|
"attrs": {
|
|
4802
4831
|
"position": carPosition,
|
|
4832
|
+
"angle": carAngle,
|
|
4803
4833
|
"title": renderTitle({
|
|
4804
4834
|
distance: carDistance,
|
|
4805
4835
|
duration: carDurationWithinMinDistance(carDistance)
|
|
@@ -4978,12 +5008,26 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4978
5008
|
geoError
|
|
4979
5009
|
} = useGeoLocation();
|
|
4980
5010
|
const carPositionRef = ref();
|
|
5011
|
+
const carAngleRef = ref();
|
|
5012
|
+
const {
|
|
5013
|
+
toGcj02
|
|
5014
|
+
} = useMapGCJ02();
|
|
4981
5015
|
watch(() => props.driverStatus, (status, _, onCleanup) => {
|
|
4982
5016
|
if (!STATUS_NEED_CAR_POSITION.includes(status))
|
|
4983
5017
|
return;
|
|
4984
|
-
const
|
|
4985
|
-
getDriverPosition().then((
|
|
4986
|
-
|
|
5018
|
+
const update = () => {
|
|
5019
|
+
getDriverPosition().then(async ({
|
|
5020
|
+
position,
|
|
5021
|
+
angle
|
|
5022
|
+
}) => {
|
|
5023
|
+
assertPoint(position);
|
|
5024
|
+
assertAngle(angle);
|
|
5025
|
+
carPositionRef.value = position ? await toGcj02(position) : void 0;
|
|
5026
|
+
carAngleRef.value = angle;
|
|
5027
|
+
});
|
|
5028
|
+
};
|
|
5029
|
+
const timer = setInterval(update, interval);
|
|
5030
|
+
update();
|
|
4987
5031
|
onCleanup(() => clearInterval(timer));
|
|
4988
5032
|
}, {
|
|
4989
5033
|
immediate: true
|
|
@@ -4998,6 +5042,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4998
5042
|
driverArrivedTitle
|
|
4999
5043
|
} = props;
|
|
5000
5044
|
const carPosition = carPositionRef.value;
|
|
5045
|
+
const carAngle = carAngleRef.value;
|
|
5001
5046
|
const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
|
|
5002
5047
|
const passengerPosition = geoError.value ? void 0 : geoPosition.value;
|
|
5003
5048
|
return h(HeycarMap, {
|
|
@@ -5033,6 +5078,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5033
5078
|
"attrs": {
|
|
5034
5079
|
"from": from,
|
|
5035
5080
|
"carPosition": carPosition,
|
|
5081
|
+
"carAngle": carAngle,
|
|
5036
5082
|
"passengerPosition": passengerPosition,
|
|
5037
5083
|
"renderTitle": renderStartSerivceTitle,
|
|
5038
5084
|
"registerOverlay": registerOverlay
|
|
@@ -5048,6 +5094,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5048
5094
|
"attrs": {
|
|
5049
5095
|
"to": to,
|
|
5050
5096
|
"carPosition": carPosition,
|
|
5097
|
+
"carAngle": carAngle,
|
|
5051
5098
|
"renderTitle": renderInServiceTitle,
|
|
5052
5099
|
"registerOverlay": registerOverlay
|
|
5053
5100
|
}
|
|
@@ -5055,6 +5102,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5055
5102
|
"attrs": {
|
|
5056
5103
|
"from": from,
|
|
5057
5104
|
"carPosition": carPosition,
|
|
5105
|
+
"carAngle": carAngle,
|
|
5058
5106
|
"passengerPosition": passengerPosition,
|
|
5059
5107
|
"title": driverArrivedTitle,
|
|
5060
5108
|
"registerOverlay": registerOverlay
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Place } from "../types/interface";
|
|
2
2
|
export declare const isPlace: (place: Partial<Place>) => place is Place;
|
|
3
3
|
export declare const sleep: (milliSeconds: number) => Promise<unknown>;
|
|
4
|
+
export declare const assertPoint: (point: unknown) => void;
|
|
5
|
+
export declare const assertAngle: (angle: unknown) => void;
|
package/package.json
CHANGED
package/todo.md
CHANGED
|
@@ -2,10 +2,8 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
|
|
|
2
2
|
|
|
3
3
|
2. Google 地址名称太长
|
|
4
4
|
3. 高德地图加载期间出现大量的请求
|
|
5
|
-
4.
|
|
6
|
-
5.
|
|
7
|
-
6. 企业微信如果关闭定位,会不停的跳 geoError 事件
|
|
8
|
-
7. 司机已接单页面,title 倒计时, 1s 更新一次 title,引起 walking 接口 1s 触发
|
|
5
|
+
4. map 的两个 slot loading 和 error slot 没有生效
|
|
6
|
+
5. 企业微信如果关闭定位,会不停的跳 geoError 事件
|
|
9
7
|
|
|
10
8
|
缩放问题
|
|
11
9
|
|
|
@@ -94,3 +92,8 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
|
|
|
94
92
|
|
|
95
93
|
- 5375
|
|
96
94
|
- 4946
|
|
95
|
+
|
|
96
|
+
0.5.5
|
|
97
|
+
|
|
98
|
+
- 4977
|
|
99
|
+
- 5381
|