mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
fix(camera): orbit on drags from the stars above 1,000 km
Below Cesium's trackball height (7,500 km by default) a drag that starts on the stars turns the camera in place, whatever enableLook says, which was the drag path to a view with no planet in it. Lower that height to the free-look height with the free-look limit, never raising it, and restore it on dispose. Above 1,000 km such a drag now orbits the globe, as it already did above 7,500 km, at a similar rate, and a tilt drag from the stars there tilts about the planet's edge or does nothing instead of turning the camera. Drags that start on the planet are unchanged.
This commit is contained in:
1 parent
64377db91a
commit
2f9d13f39d
3 files changed
+38
-11
No files matched your search
@@ -359,7 +359,7 @@ test('trackpad pinch falls back to the original event when relay construction fa
|
||||
|
||||
function freeLookFixture({ enableLook = true, height = 0 } = {}) {
|
||||
const listeners = new Set();
|
||||
const controller = { enableLook };
|
||||
const controller = { enableLook, minimumTrackBallHeight: 7_500_000 };
|
||||
const camera = { positionCartographic: { height } };
|
||||
const viewer = {
|
||||
camera,
|
||||
@@ -399,6 +399,27 @@ test('free look follows camera height and is restored on dispose', () => {
|
||||
assert.equal(f.listeners.size, 0);
|
||||
});
|
||||
|
||||
test('drags that start on the stars orbit above the free-look height', () => {
|
||||
// Below Cesium's trackball height such a drag turns the camera in place.
|
||||
const f = freeLookFixture({ height: 500 });
|
||||
const dispose = installFreeLookHeightLimit(f.viewer);
|
||||
assert.equal(
|
||||
f.controller.minimumTrackBallHeight,
|
||||
FREE_LOOK_MAX_HEIGHT_METERS,
|
||||
);
|
||||
dispose();
|
||||
assert.equal(f.controller.minimumTrackBallHeight, 7_500_000);
|
||||
|
||||
const lower = freeLookFixture({ height: 500 });
|
||||
lower.controller.minimumTrackBallHeight = 500_000;
|
||||
installFreeLookHeightLimit(lower.viewer)();
|
||||
assert.equal(
|
||||
lower.controller.minimumTrackBallHeight,
|
||||
500_000,
|
||||
'never raised',
|
||||
);
|
||||
});
|
||||
|
||||
test('free look keeps a setting other code makes after it is installed', () => {
|
||||
const f = freeLookFixture({ height: 500 });
|
||||
const dispose = installFreeLookHeightLimit(f.viewer);
|
||||
|
||||
Reference in new issue
Block a user