Skip to content

Commit e802385

Browse files
committed
Tuning: UI touch: right-aligned addonpart [Reload] buttons.
1 parent 6183569 commit e802385

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

source/main/gui/panels/GUI_TopMenubar.cpp

+13-5
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ void TopMenubar::Draw(float dt)
16111611
{
16121612
for (size_t i = 0; i < tuning_addonparts.size(); i++)
16131613
{
1614-
CacheEntryPtr& addonpart_entry = tuning_addonparts[i];
1614+
const CacheEntryPtr& addonpart_entry = tuning_addonparts[i];
16151615

16161616
ImGui::PushID(addonpart_entry->fname.c_str());
16171617
const bool conflict_w_hovered = tuning_hovered_addonpart
@@ -1660,11 +1660,19 @@ void TopMenubar::Draw(float dt)
16601660
{
16611661
tuning_hovered_addonpart = nullptr;
16621662
}
1663-
// Reload button
1663+
// Reload button (right-aligned)
16641664
ImGui::SameLine();
1665-
ImGui::Dummy(ImVec2(10.f, 1.f));
1666-
ImGui::SameLine();
1667-
if (ImGui::SmallButton(_LC("Tuning", "Reload")))
1665+
if (tuning_rwidget_cursorx_min < ImGui::GetCursorPosX()) // Make sure button won't draw over save button
1666+
tuning_rwidget_cursorx_min = ImGui::GetCursorPosX();
1667+
ImGui::AlignTextToFramePadding();
1668+
std::string reloadbtn_text = _LC("Tuning", "Reload");
1669+
float delbtn_w = ImGui::CalcTextSize(reloadbtn_text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
1670+
float delbtn_cursorx = ImGui::GetWindowContentRegionWidth() - delbtn_w;
1671+
if (delbtn_cursorx < tuning_rwidget_cursorx_min)
1672+
delbtn_cursorx = tuning_rwidget_cursorx_min;
1673+
ImGui::SetCursorPosX(delbtn_cursorx);
1674+
bool reloadbtn_pressed = ImGui::SmallButton(reloadbtn_text.c_str());
1675+
if (reloadbtn_pressed)
16681676
{
16691677
// Create spawn request while actor still exists
16701678
// Note we don't use `ActorModifyRequest::Type::RELOAD` because we don't need the bundle reloaded.

0 commit comments

Comments
 (0)