Skip to content

Commit 1c1fa3b

Browse files
committed
feat: Use trip colors for pickup and drop off
1 parent 1301a99 commit 1c1fa3b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/TripObjects.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ export class TripObjects {
2121
let points;
2222
if (direction === "up") {
2323
points = [
24-
{ x: 12, y: 20 + shift }, // Top point of chevron
25-
{ x: 8, y: 24 + shift }, // Bottom left
26-
{ x: 16, y: 24 + shift }, // Bottom right
27-
{ x: 12, y: 20 + shift },
24+
{ x: 12, y: 16 + shift }, // Top point of chevron
25+
{ x: 5, y: 24 + shift }, // Bottom left
26+
{ x: 19, y: 24 + shift }, // Bottom right
27+
{ x: 12, y: 16 + shift },
2828
];
2929
} else {
3030
// "down"
3131
points = [
3232
{ x: 12, y: 24 + shift }, // Bottom point of chevron
33-
{ x: 8, y: 20 + shift }, // Top left
34-
{ x: 16, y: 20 + shift }, // Top right
33+
{ x: 5, y: 16 + shift }, // Top left
34+
{ x: 19, y: 16 + shift }, // Top right
3535
{ x: 12, y: 24 + shift },
3636
];
3737
}
3838

39-
return `<path d="M${points[0].x} ${points[0].y}L${points[1].x} ${points[1].y}L${points[2].x} ${points[2].y}L${points[3].x} ${points[3].y}Z" fill="${color}" stroke="${color}" stroke-width="1"/>`;
39+
return `<path d="M${points[0].x} ${points[0].y}L${points[1].x} ${points[1].y}L${points[2].x} ${points[2].y}L${points[3].x} ${points[3].y}Z" fill="${color}" stroke="black" stroke-width="1" stroke-linejoin="round"/>`;
4040
};
4141

4242
const svgBase = `
4343
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
44-
${isActual ? (isPickup ? createChevronPath("up", -4) : createChevronPath("down", -4)) : ""}
44+
${isActual ? (isPickup ? createChevronPath("up", -5) : createChevronPath("down", -5)) : ""}
4545
${isPickup ? createChevronPath("up") : createChevronPath("down")}
4646
</svg>`;
4747

@@ -169,6 +169,7 @@ export class TripObjects {
169169
}
170170

171171
const markers = [];
172+
const tripColor = getColor(trip.tripIdx);
172173

173174
// Get points
174175
const pickupPoint = trip.getPickupPoint();
@@ -177,26 +178,26 @@ export class TripObjects {
177178
const actualDropoffPoint = trip.getActualDropoffPoint();
178179

179180
// Create pickup markers
180-
const pickupMarker = this.createMarkerWithEvents(pickupPoint, "pickup", "#3d633d", actualPickupPoint, tripId);
181+
const pickupMarker = this.createMarkerWithEvents(pickupPoint, "pickup", tripColor, actualPickupPoint, tripId);
181182
if (pickupMarker) markers.push(pickupMarker);
182183

183184
const actualPickupMarker = this.createMarkerWithEvents(
184185
actualPickupPoint,
185186
"actualPickup",
186-
"#3d633d",
187+
tripColor,
187188
pickupPoint,
188189
tripId
189190
);
190191
if (actualPickupMarker) markers.push(actualPickupMarker);
191192

192193
// Create dropoff markers
193-
const dropoffMarker = this.createMarkerWithEvents(dropoffPoint, "dropoff", "#0000FF", actualDropoffPoint, tripId);
194+
const dropoffMarker = this.createMarkerWithEvents(dropoffPoint, "dropoff", tripColor, actualDropoffPoint, tripId);
194195
if (dropoffMarker) markers.push(dropoffMarker);
195196

196197
const actualDropoffMarker = this.createMarkerWithEvents(
197198
actualDropoffPoint,
198199
"actualDropoff",
199-
"#0000FF",
200+
tripColor,
200201
dropoffPoint,
201202
tripId
202203
);

0 commit comments

Comments
 (0)