Skip to content

Commit

Permalink
use bearing and show vehicle id
Browse files Browse the repository at this point in the history
  • Loading branch information
jonerrr committed Oct 27, 2024
1 parent 1d3bc45 commit 0e14063
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 4 deletions.
70 changes: 70 additions & 0 deletions bus-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions bus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bus-map",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
14 changes: 11 additions & 3 deletions src/lib/Trips.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
route_id: string;
stop_id?: number;
status: 'None' | 'Layover';
bearing: number;
vehicle_id: string;
}
let clicked_feature: Trip | undefined = $state(undefined);
Expand Down Expand Up @@ -60,14 +62,20 @@
on:click={(e) => (clicked_feature = e.detail.features[0].properties as Trip)}
hoverCursor="pointer"
layout={{
'icon-image': ['match', ['get', 'direction'], 0, 'bus_right', 1, 'bus_left', 'bus_left'],
'icon-size': ['interpolate', ['exponential', 0.5], ['zoom'], 8, 0.05, 17, 0.1]
// 'icon-image': ['match', ['get', 'direction'], 0, 'bus_right', 1, 'bus_left', 'bus_left'],
'icon-image': 'bus_left',
'icon-size': ['interpolate', ['exponential', 0.5], ['zoom'], 8, 0.05, 17, 0.1],
'icon-rotate': ['coalesce', ['get', 'bearing'], 0]
}}
>
<Popup>
{#if clicked_feature}
<div class={`max-w-[70vw] flex flex-col gap-1 text-black`}>
<h1 class="font-bold text-lg">{clicked_feature.route_id}</h1>
<div class="flex items-center justify-between gap-1">
<h1 class="font-bold text-lg">{clicked_feature.route_id}</h1>
<h3>#{clicked_feature.vehicle_id}</h3>
</div>
<!-- {clicked_feature.bearing} -->
{#if clicked_feature.passengers && clicked_feature.capacity}
<div class="flex gap-1">
<span class="font-bold">passengers</span>: {clicked_feature.passengers} / {clicked_feature.capacity}
Expand Down
3 changes: 3 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
// map.setLayoutProperty('background', 'visibility', 'none');
// map.setLayoutProperty('background', 'visibility', 'none');

// const bus_up = await map.loadImage($mode !== 'light' ? '/bus-up-white.png' : '/bus-up.png');
// map.addImage('bus_up', bus_up.data);

const bus_right = await map.loadImage(
$mode !== 'light' ? '/bus_white_right.png' : '/bus_black_right.png'
);
Expand Down
Binary file added static/bus-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/bus_black_left (Copy).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/bus_black_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/bus_black_right (Copy).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/bus_white_left (Copy).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/bus_white_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/bus_white_right (Copy).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0e14063

Please sign in to comment.