don't reset positions while hidden

This commit is contained in:
Crispy 2023-04-25 18:41:02 +02:00
parent edca13ca09
commit 0042ee3b58
2 changed files with 28 additions and 20 deletions

View file

@ -162,10 +162,10 @@ void App::UpdateInput()
{ {
panel.SetHidden(_hidden); panel.SetHidden(_hidden);
} }
_root_overlay.SetHidden(_hidden || !_edit_mode); UpdateUIVisibility();
_controllers[0]->SetHidden(_hidden || !_edit_mode);
_controllers[1]->SetHidden(_hidden || !_edit_mode);
} }
if (!_hidden)
{
if (IsInputJustPressed(_input_handles.reset)) if (IsInputJustPressed(_input_handles.reset))
{ {
_root_overlay.SetTransformWorld(&root_start_pose); _root_overlay.SetTransformWorld(&root_start_pose);
@ -175,12 +175,10 @@ void App::UpdateInput()
panel.ResetTransform(); panel.ResetTransform();
} }
} }
if (!_hidden && IsInputJustPressed(_input_handles.edit_mode)) if (IsInputJustPressed(_input_handles.edit_mode))
{ {
_edit_mode = !_edit_mode; _edit_mode = !_edit_mode;
_root_overlay.SetHidden(_hidden || !_edit_mode); UpdateUIVisibility();
_controllers[0]->SetHidden(_hidden || !_edit_mode);
_controllers[1]->SetHidden(_hidden || !_edit_mode);
} }
if (_edit_mode) if (_edit_mode)
{ {
@ -188,6 +186,15 @@ void App::UpdateInput()
_controllers[1]->Update(); _controllers[1]->Update();
} }
} }
}
void App::UpdateUIVisibility()
{
bool state = _hidden || !_edit_mode;
_root_overlay.SetHidden(state);
_controllers[0]->SetHidden(state);
_controllers[1]->SetHidden(state);
}
void App::UpdateFramebuffer() void App::UpdateFramebuffer()
{ {

View file

@ -78,4 +78,5 @@ class App
void UpdateFramebuffer(); void UpdateFramebuffer();
void UpdateInput(); void UpdateInput();
void UpdateUIVisibility();
}; };