BugFix WorkspaceWindow clear on ESC and Transition view

This commit is contained in:
Bruno Herbelin
2022-03-27 00:09:18 +01:00
parent 5b6ec81cee
commit 0f3e856438
2 changed files with 16 additions and 5 deletions

View File

@@ -157,8 +157,10 @@ void TransitionView::update(float dt)
// request update // request update
transition_source_->touch(); transition_source_->touch();
if (d > 0.2f) if (d > 0.2f) {
Mixer::manager().setView(View::MIXING); Mixer::manager().setView(View::MIXING);
WorkspaceWindow::restoreWorkspace();
}
} }

View File

@@ -231,6 +231,8 @@ uint64_t UserInterface::Runtime() const
void UserInterface::handleKeyboard() void UserInterface::handleKeyboard()
{ {
static bool esc_repeat_ = false;
const ImGuiIO& io = ImGui::GetIO(); const ImGuiIO& io = ImGui::GetIO();
alt_modifier_active = io.KeyAlt; alt_modifier_active = io.KeyAlt;
shift_modifier_active = io.KeyShift; shift_modifier_active = io.KeyShift;
@@ -383,10 +385,17 @@ void UserInterface::handleKeyboard()
navigator.hidePannel(); navigator.hidePannel();
// toggle clear workspace // toggle clear workspace
WorkspaceWindow::toggleClearRestoreWorkspace(); WorkspaceWindow::toggleClearRestoreWorkspace();
// ESC key is not yet maintained pressed
esc_repeat_ = false;
} }
else if ( WorkspaceWindow::clear() && ImGui::IsKeyReleased( GLFW_KEY_ESCAPE )) { else if (ImGui::IsKeyPressed( GLFW_KEY_ESCAPE, true )) {
// toggle clear workspace // ESC key is maintained pressed
WorkspaceWindow::toggleClearRestoreWorkspace(); esc_repeat_ = true;
}
else if ( esc_repeat_ && WorkspaceWindow::clear() && ImGui::IsKeyReleased( GLFW_KEY_ESCAPE )) {
// restore cleared workspace when releasing ESC after maintain
WorkspaceWindow::restoreWorkspace();
esc_repeat_ = false;
} }
else if (ImGui::IsKeyPressed( GLFW_KEY_END, false )) { else if (ImGui::IsKeyPressed( GLFW_KEY_END, false )) {
Settings::application.render.disabled = !Settings::application.render.disabled; Settings::application.render.disabled = !Settings::application.render.disabled;
@@ -1982,7 +1991,7 @@ void WorkspaceWindow::toggleClearRestoreWorkspace()
{ {
// do not toggle if an animation is ongoing // do not toggle if an animation is ongoing
for(auto it = windows_.cbegin(); it != windows_.cend(); ++it) { for(auto it = windows_.cbegin(); it != windows_.cend(); ++it) {
if ( (*it)->Visible() && (*it)->impl_ && (*it)->impl_->animation ) if ( (*it)->impl_ && (*it)->impl_->animation )
return; return;
} }