mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(transit): give vehicle icons a readable front, and none without a course
At the ~20 px the fleet renders at, the bus, tram, metro and unknown glyphs were near-symmetric boxes: rotated along the course, nothing showed which end was the front. Each now has a front built into its outline (an arrow-like nose for the bus, a pointed cab for the tram, a chamfered cab for the metro), so it survives the tint, the halo and the sensor profiles, which keep only the outline. A vehicle with no known course sits at rotation 0, where a pointed glyph would claim it is heading north. Those vehicles, fleet and selected alike, now get a symmetric outline (rail and ferry included) and switch to the pointed one once a course arrives. The raster cache doubles to a fixed 72 variants. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7d8b80db0a
commit
6172be3995
4 files changed
+225
-89
No files matched your search
@@ -232,11 +232,16 @@ export function createRendering({ state, services, parts }) {
|
||||
const displayPx = basePx * presetSpriteScale(style, selected);
|
||||
const frame = haloFrame(halo, displayPx);
|
||||
const px = displayPx * frame.ratio;
|
||||
// A glyph with a front only when there is a course to point it along:
|
||||
// without one the billboard sits at rotation 0 and a nose would say north.
|
||||
const heading = Number.isFinite(entry.courseDeg);
|
||||
entry.iconHeading = heading;
|
||||
marker.image = transitIcon(
|
||||
entry.mode,
|
||||
selected ? SELECTED_ICON_PX : undefined,
|
||||
{
|
||||
style,
|
||||
heading,
|
||||
},
|
||||
);
|
||||
marker.width = px;
|
||||
@@ -252,6 +257,12 @@ export function createRendering({ state, services, parts }) {
|
||||
MODE_CESIUM_COLORS[entry.mode] || MODE_CESIUM_COLORS.unknown;
|
||||
}
|
||||
|
||||
/** Swap between the pointed and the neutral glyph when a course appears or is lost. */
|
||||
function syncHeadingIcon(entry) {
|
||||
if (entry.marker && entry.iconHeading !== Number.isFinite(entry.courseDeg))
|
||||
applySpriteStyle(entry);
|
||||
}
|
||||
|
||||
function addMarker(key, entry) {
|
||||
const marker = state._markers.add({
|
||||
id: key,
|
||||
@@ -324,6 +335,7 @@ export function createRendering({ state, services, parts }) {
|
||||
for (const entry of state._visible) {
|
||||
// Idle contacts still need a course when their first usable bearing arrives.
|
||||
if (!state._moving.has(entry)) applyDisplayCourse(entry, monoNow);
|
||||
syncHeadingIcon(entry);
|
||||
if (entry.key === state._selectedKey) continue;
|
||||
const course = entry.courseDeg;
|
||||
if (!Number.isFinite(course)) {
|
||||
@@ -427,6 +439,7 @@ export function createRendering({ state, services, parts }) {
|
||||
refreshRotations(now);
|
||||
const selected = state._vehicles.get(state._selectedKey);
|
||||
if (selected && state._visible.has(selected)) {
|
||||
syncHeadingIcon(selected);
|
||||
selected.marker.rotation = Number.isFinite(selected.courseDeg)
|
||||
? perspectiveProjectedRotation(
|
||||
state._viewer.scene,
|
||||
|
||||
Reference in new issue
Block a user