fix bug deselection of current source in navigator

This commit is contained in:
brunoherbelin
2020-05-03 22:07:05 +02:00
parent 68728d8cb7
commit 4e2e3bc739

View File

@@ -792,12 +792,12 @@ void Navigator::Render()
const ImU32 color = ImGui::GetColorU32( style.Colors[ImGuiCol_Text] ); const ImU32 color = ImGui::GetColorU32( style.Colors[ImGuiCol_Text] );
draw_list->AddRect(p, ImVec2(p.x + 2.f, p.y + icon_width), color, 0.0f, 0, 3.f); draw_list->AddRect(p, ImVec2(p.x + 2.f, p.y + icon_width), color, 0.0f, 0, 3.f);
} }
// draw select box // draw select box
if (ImGui::Selectable( (*iter)->initials(), &selected_button[index], 0, iconsize)) if (ImGui::Selectable( (*iter)->initials(), &selected_button[index], 0, iconsize))
{ {
toggle(index); toggle(index);
if (selected_button[index])
Mixer::manager().setCurrentSource(selected_source_index); Mixer::manager().setCurrentSource(selected_source_index);
} }
} }
@@ -851,10 +851,9 @@ void Navigator::Render()
else if (selected_source_index > -1) else if (selected_source_index > -1)
{ {
// manipulate current source, and activate corresponding button // manipulate current source, and activate corresponding button
Source *s = Mixer::manager().currentSource();
clearSelection(); clearSelection();
selected_button[Mixer::manager().indexCurrentSource()] = true; selected_button[Mixer::manager().indexCurrentSource()] = true;
RenderSourcePannel(s); RenderSourcePannel(Mixer::manager().currentSource());
} }
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);