Skip to content

Commit

Permalink
Tuning: UI touch: right-aligned addonpart [Reload] buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Apr 27, 2024
1 parent 6183569 commit e802385
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions source/main/gui/panels/GUI_TopMenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ void TopMenubar::Draw(float dt)
{
for (size_t i = 0; i < tuning_addonparts.size(); i++)
{
CacheEntryPtr& addonpart_entry = tuning_addonparts[i];
const CacheEntryPtr& addonpart_entry = tuning_addonparts[i];

ImGui::PushID(addonpart_entry->fname.c_str());
const bool conflict_w_hovered = tuning_hovered_addonpart
Expand Down Expand Up @@ -1660,11 +1660,19 @@ void TopMenubar::Draw(float dt)
{
tuning_hovered_addonpart = nullptr;
}
// Reload button
// Reload button (right-aligned)
ImGui::SameLine();
ImGui::Dummy(ImVec2(10.f, 1.f));
ImGui::SameLine();
if (ImGui::SmallButton(_LC("Tuning", "Reload")))
if (tuning_rwidget_cursorx_min < ImGui::GetCursorPosX()) // Make sure button won't draw over save button
tuning_rwidget_cursorx_min = ImGui::GetCursorPosX();
ImGui::AlignTextToFramePadding();
std::string reloadbtn_text = _LC("Tuning", "Reload");
float delbtn_w = ImGui::CalcTextSize(reloadbtn_text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
float delbtn_cursorx = ImGui::GetWindowContentRegionWidth() - delbtn_w;
if (delbtn_cursorx < tuning_rwidget_cursorx_min)
delbtn_cursorx = tuning_rwidget_cursorx_min;
ImGui::SetCursorPosX(delbtn_cursorx);
bool reloadbtn_pressed = ImGui::SmallButton(reloadbtn_text.c_str());
if (reloadbtn_pressed)
{
// Create spawn request while actor still exists
// Note we don't use `ActorModifyRequest::Type::RELOAD` because we don't need the bundle reloaded.
Expand Down

0 comments on commit e802385

Please sign in to comment.