mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-08 18:13:52 +00:00
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:
parent
072513d0f9
commit
b831bbcbc9
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue