mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Address review: zoom, drag, clearance and pitchDeg for voice tilt
- A zoom during a pivoting tilt now scales the range the tilt holds, as it already did for orbit, instead of being undone on the next frame while reporting success. The zoom limits no longer move a view the wrong way: a zoom in leaves a view closer than 80 m in place, and a zoom out leaves an orbit beyond 5,000 km where it is. - A grab, touch or wheel on the map while a voice fly-to is in flight drops the motion queued behind it. Cesium lands the flight anyway, so the orbit or tilt would otherwise take the camera back. Chained fly-tos in one reply keep the earliest snapshot. - A pivot tilt toward the horizon stops lowering the camera at 150 m above the pivot and tilts the rest in place, so a close view no longer ends inside tiles or a hillside. - pitchDeg is an absolute angle. A direction that contradicts it is refused, judged from the pitch the swing starts at, and the tool description says so.
This commit is contained in:
1 parent
2ac73519ec
commit
5c74b860b7
8 files changed
+331
-31
No files matched your search
+19
-3
@@ -47,6 +47,7 @@ import {
|
||||
flyRoute,
|
||||
interruptCameraMotion,
|
||||
adjustOrbitRange,
|
||||
manualCameraInputCount,
|
||||
} from '../cameraVerbs.js';
|
||||
import * as defaultFloorServices from '../data/groundFloor.js';
|
||||
import { isPickedWorldPosition } from '../data/scenePick.js';
|
||||
@@ -1107,7 +1108,10 @@ export function createGevActionRunner({
|
||||
runOptions,
|
||||
);
|
||||
}
|
||||
const flight = trackVoiceFlight();
|
||||
// Chained fly-tos in one reply: a grab during the earlier one counts.
|
||||
const flight = trackVoiceFlight(
|
||||
voiceFlight && !voiceFlight.done ? voiceFlight.inputCount : undefined,
|
||||
);
|
||||
voiceFlight = flight;
|
||||
const flown = flyToRequestedLocation(viewer, args, {
|
||||
onFlightEnd: flight.settle,
|
||||
@@ -1194,7 +1198,8 @@ export function createGevActionRunner({
|
||||
voiceFlight &&
|
||||
!voiceFlight.done
|
||||
) {
|
||||
const status = await waitForVoiceFlight(voiceFlight, runOptions.signal);
|
||||
const flight = voiceFlight;
|
||||
const status = await waitForVoiceFlight(flight, runOptions.signal);
|
||||
if (!current())
|
||||
return { ok: false, action: 'move_camera', cancelled: true };
|
||||
if (status !== 'arrived')
|
||||
@@ -1204,6 +1209,15 @@ export function createGevActionRunner({
|
||||
motion,
|
||||
error: `Not run: the flight this ${motion} was waiting for did not arrive.`,
|
||||
};
|
||||
// The flight lands even when the user grabs the globe mid-flight;
|
||||
// the queued motion must not take the camera back from them.
|
||||
if (manualCameraInputCount() !== flight.inputCount)
|
||||
return {
|
||||
ok: false,
|
||||
action: 'move_camera',
|
||||
motion,
|
||||
error: `Not run: the user moved the camera during the flight, so the ${motion} was dropped.`,
|
||||
};
|
||||
}
|
||||
return moveCamera(args, (navigate, releaseOptions) =>
|
||||
runManagedVoiceNavigation(
|
||||
@@ -2722,10 +2736,12 @@ async function frameOverhead(viewer, dataManager, styleManager, args = {}) {
|
||||
}
|
||||
|
||||
/** A voice flight's end: 'arrived', 'cancelled' or 'failed', settled once. */
|
||||
function trackVoiceFlight() {
|
||||
function trackVoiceFlight(inputCount = manualCameraInputCount()) {
|
||||
let resolve;
|
||||
const flight = {
|
||||
done: false,
|
||||
// Manual input after this means the user took the camera mid-flight.
|
||||
inputCount,
|
||||
ended: new Promise((settle) => {
|
||||
resolve = settle;
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user