mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(camera): moveEnd fires during a follow once the eye stands still, as Cesium's did
Cesium raised moveEnd 500 ms after the camera last moved, following or not: a followed target that moves keeps the eye moving, and one that stands still (a marker, a parked aircraft) lets the move end once the user stops orbiting it. The port never raised moveEnd while following, so Weather, Recent Imagery, the share link and every other moveEnd listener stopped catching up around a still target. The rule is now the eye's alone, through the shared camera events.
This commit is contained in:
1 parent
63a6595eaf
commit
5d48503c51
6 files changed
+25
-28
No files matched your search
@@ -180,7 +180,7 @@ test('the stub says where it draws an item, for a camera that is not its own', (
|
||||
r.destroy();
|
||||
});
|
||||
|
||||
test('the stub camera ends no move while it follows', () => {
|
||||
test('a follow ends its move once the target stands still, and never while it moves', () => {
|
||||
const r = createStubRenderer();
|
||||
const seen = [];
|
||||
r.camera.on('moveStart', () => seen.push('start'));
|
||||
@@ -194,10 +194,18 @@ test('the stub camera ends no move while it follows', () => {
|
||||
viewFrom: { x: 0, y: -500, z: 300 },
|
||||
});
|
||||
r.testing.advance(2000);
|
||||
assert.deepEqual(seen, ['start'], 'moveEnd waits for the follow to end');
|
||||
r.camera.follow(null);
|
||||
r.testing.advance(1000);
|
||||
assert.deepEqual(seen, ['start', 'end']);
|
||||
assert.deepEqual(seen, ['start', 'end'], 'a still target ends the move');
|
||||
// A moving target keeps the eye moving: no moveEnd while it moves.
|
||||
let east = 0;
|
||||
r.camera.follow({
|
||||
key: 'moving',
|
||||
position: () =>
|
||||
toEcef({ lon: -97.74 + (east += 1e-5), lat: 30.27, height: 0 }),
|
||||
frame: 'enu',
|
||||
viewFrom: { x: 0, y: -500, z: 300 },
|
||||
});
|
||||
r.testing.advance(2000);
|
||||
assert.deepEqual(seen, ['start', 'end', 'start'], 'no end while it moves');
|
||||
r.destroy();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user