💄 Trip itinerary: alternate day colors and connect singleton days
This commit is contained in:
parent
ac2d217587
commit
5a7c58241c
@ -334,10 +334,7 @@ export class TripComponent implements AfterViewInit {
|
|||||||
this.totalPrice =
|
this.totalPrice =
|
||||||
this.trip?.days
|
this.trip?.days
|
||||||
.flatMap((d) => d.items)
|
.flatMap((d) => d.items)
|
||||||
.reduce(
|
.reduce((price, item) => price + (item.price ?? 0), 0) ?? 0;
|
||||||
(price, item) => price + (item.price ?? item.place?.price ?? 0),
|
|
||||||
0,
|
|
||||||
) ?? 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetPlaceHighlightMarker() {
|
resetPlaceHighlightMarker() {
|
||||||
@ -447,22 +444,33 @@ export class TripComponent implements AfterViewInit {
|
|||||||
"#e6beff",
|
"#e6beff",
|
||||||
"#808000",
|
"#808000",
|
||||||
];
|
];
|
||||||
|
let prevPoint: [number, number] | null = null;
|
||||||
|
|
||||||
Object.values(dayGroups).forEach((group, idx) => {
|
Object.values(dayGroups).forEach((group, idx) => {
|
||||||
const path = antPath(
|
const coords = group.map((day: any) => [day.lat, day.lng]);
|
||||||
group.map((day: any) => [day.lat, day.lng]),
|
const pathOptions = {
|
||||||
{
|
|
||||||
delay: 600,
|
delay: 600,
|
||||||
dashArray: [10, 20],
|
dashArray: [10, 20],
|
||||||
weight: 5,
|
weight: 5,
|
||||||
color: COLORS[idx % 14],
|
color: COLORS[idx % COLORS.length],
|
||||||
pulseColor: "#FFFFFF",
|
pulseColor: "#FFFFFF",
|
||||||
paused: false,
|
paused: false,
|
||||||
reverse: false,
|
reverse: false,
|
||||||
hardwareAccelerated: true,
|
hardwareAccelerated: true,
|
||||||
},
|
};
|
||||||
);
|
|
||||||
|
|
||||||
|
if (coords.length >= 2) {
|
||||||
|
const path = antPath(coords, pathOptions);
|
||||||
layGroup.addLayer(path);
|
layGroup.addLayer(path);
|
||||||
|
prevPoint = coords[coords.length - 1];
|
||||||
|
} else if (coords.length === 1 && prevPoint) {
|
||||||
|
const path = antPath([prevPoint, coords[0]], pathOptions);
|
||||||
|
layGroup.addLayer(path);
|
||||||
|
prevPoint = coords[0];
|
||||||
|
} else if (coords.length === 1) {
|
||||||
|
prevPoint = coords[0];
|
||||||
|
}
|
||||||
|
|
||||||
group.forEach((day: any) => {
|
group.forEach((day: any) => {
|
||||||
if (!day.isPlace) layGroup.addLayer(tripDayMarker(day));
|
if (!day.isPlace) layGroup.addLayer(tripDayMarker(day));
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user