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,31 +162,38 @@ 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 (IsInputJustPressed(_input_handles.reset)) if (!_hidden)
{ {
_root_overlay.SetTransformWorld(&root_start_pose); if (IsInputJustPressed(_input_handles.reset))
_root_overlay.SetWidth(0.25f);
for (auto &panel : _panels)
{ {
panel.ResetTransform(); _root_overlay.SetTransformWorld(&root_start_pose);
_root_overlay.SetWidth(0.25f);
for (auto &panel : _panels)
{
panel.ResetTransform();
}
}
if (IsInputJustPressed(_input_handles.edit_mode))
{
_edit_mode = !_edit_mode;
UpdateUIVisibility();
}
if (_edit_mode)
{
_controllers[0]->Update();
_controllers[1]->Update();
} }
} }
if (!_hidden && IsInputJustPressed(_input_handles.edit_mode)) }
{
_edit_mode = !_edit_mode; void App::UpdateUIVisibility()
_root_overlay.SetHidden(_hidden || !_edit_mode); {
_controllers[0]->SetHidden(_hidden || !_edit_mode); bool state = _hidden || !_edit_mode;
_controllers[1]->SetHidden(_hidden || !_edit_mode); _root_overlay.SetHidden(state);
} _controllers[0]->SetHidden(state);
if (_edit_mode) _controllers[1]->SetHidden(state);
{
_controllers[0]->Update();
_controllers[1]->Update();
}
} }
void App::UpdateFramebuffer() void App::UpdateFramebuffer()

View file

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