Skip to content

Commit d7675dd

Browse files
midona-rhelGistix
andauthored
fix(ui): anchor reset settings button position (#1621)
Co-authored-by: Giovanni Correia <[email protected]>
1 parent db72d81 commit d7675dd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Menu/FeatureListRenderer.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,18 @@ void FeatureListRenderer::DrawMenuVisitor::RenderFeatureSettingsTab(Feature* fea
446446
}
447447

448448
if (!isDisabled && isLoaded) {
449-
ImVec2 childSize = ImGui::GetWindowSize();
449+
// Position button in screen coordinates so it stays fixed in viewport when scrolling
450+
ImVec2 windowPos = ImGui::GetWindowPos();
451+
ImVec2 windowSize = ImGui::GetWindowSize();
452+
float scrollbarWidth = ImGui::GetScrollMaxY() > 0 ? ImGui::GetStyle().ScrollbarSize : 0.0f;
453+
450454
float iconDimension = ImGui::GetFrameHeight() * 1.2f;
451455
ImVec2 iconSize = ImVec2(iconDimension, iconDimension);
452-
ImGui::SetCursorPos(ImVec2(childSize.x - iconSize.x - 10.0f, childSize.y - iconSize.y - 10.0f));
456+
float padding = 10.0f;
457+
ImVec2 buttonPos = ImVec2(
458+
windowPos.x + windowSize.x - iconSize.x - padding - scrollbarWidth,
459+
windowPos.y + windowSize.y - iconSize.y - padding);
460+
ImGui::SetCursorScreenPos(buttonPos);
453461
auto& theme = globals::menu->GetTheme().Palette;
454462
ImVec4 iconColor = theme.Text;
455463
iconColor.w *= 0.7f;

0 commit comments

Comments
 (0)