fix(editor): toast on non-finite fly-to target instead of silent no-op

Camera::setPosition now refuses NaN, so flyToSelected() would silently
do nothing if the selected entity had a corrupted position. Surface it
as a toast so the user knows the selection is unusable rather than
wondering why the camera didn't move.
This commit is contained in:
Kelsi 2026-05-06 20:05:45 -07:00
parent 072513d0f9
commit b831bbcbc9

View file

@ -1576,6 +1576,15 @@ void EditorApp::flyToSelected() {
have = true;
}
if (!have) return;
// Reject NaN target — would feed NaN into camera.setPosition (which
// now refuses it but the user would get no camera movement and no
// error message). Show the toast instead so the user knows the
// selection is corrupt.
if (!std::isfinite(target.x) || !std::isfinite(target.y) ||
!std::isfinite(target.z)) {
showToast("Selection has non-finite position; can't fly to it");
return;
}
// Place camera back-and-up from the target along the current view direction
// and aim it at the target. Distance scales with camera speed so it works