mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 17:22:19 +00:00
fix(cockpit): a provider's subject rides where it is drawn, and the documented provider rides a moving train
- A frame with no speedMps gets an exact anchor: an inertial one ran on at zero speed and closed at 0.75 m/s, so the camera fell kilometres behind a moving train. The docs example now passes speedMps and anchor: 'exact', a name for its HUD, and isEntryAllowed for a train bound to its line. - Transit's snapshot height is the floor where playback draws the vehicle, not the newest report's floor uphill, and null while that floor is cold, so a view waits for the surface instead of standing on the ellipsoid. - Rail's direction follows playback once it has placed the train: a report that runs back (a reversal, or GPS jitter) no longer turns the view while the drawn train still runs forward. - A frame's id is trimmed as the candidate's is. - A double-click on the selected vessel no longer enters an application's subject that took entry after it. - The docs import from gods-eye-view/..., the package's name.
This commit is contained in:
1 parent
974023510f
commit
4bb7b411e9
10 files changed
+161
-21
No files matched your search
@@ -234,3 +234,31 @@ test('a binding learns which way its train runs, and keeps it through a stop', (
|
||||
);
|
||||
assert.equal(rebound?.direction ?? 0, 0);
|
||||
});
|
||||
|
||||
test('a report that runs back turns the drawn train only when playback does', () => {
|
||||
const p = pack();
|
||||
const ids = { tripId: 'full', routeId: 'main' };
|
||||
const binding = bindTrainPath(p, ids, fix(0, 300, 0));
|
||||
const forward = {
|
||||
from: { seq: 1, ...fix(0, 300, 0) },
|
||||
to: { seq: 2, ...fix(10_000, 500, 0) },
|
||||
};
|
||||
const sample = (fraction) => ({ fromSeq: 1, toSeq: 2, fraction });
|
||||
assert.ok(placeOnPath(binding, sample(0.2), forward, {}));
|
||||
assert.equal(binding.direction, 1);
|
||||
// The newest report lies behind the last one (a reversal, or GPS jitter)
|
||||
// while playback still draws the forward segment.
|
||||
assert.ok(followFix(binding, fix(10_000, 500, 0)));
|
||||
assert.ok(followFix(binding, fix(20_000, 450, 0)));
|
||||
assert.ok(placeOnPath(binding, sample(0.6), forward, {}));
|
||||
assert.equal(binding.direction, 1, 'the drawn train still runs forward');
|
||||
// Playback reaches the reversed segment: now it turns.
|
||||
const back = {
|
||||
from: { seq: 2, ...fix(10_000, 500, 0) },
|
||||
to: { seq: 3, ...fix(20_000, 450, 0) },
|
||||
};
|
||||
assert.ok(
|
||||
placeOnPath(binding, { fromSeq: 2, toSeq: 3, fraction: 0.5 }, back, {}),
|
||||
);
|
||||
assert.equal(binding.direction, -1);
|
||||
});
|
||||
Reference in new issue
Block a user