1
0
mirror of synced 2024-12-01 02:37:18 +01:00

fix: Sidebar background and separator line overlapping footer

This commit is contained in:
WerWolv 2024-06-20 22:33:42 +02:00
parent 2e3f523f32
commit 24f535474a

View File

@ -50,12 +50,10 @@ namespace hex::plugin::builtin {
} }
} }
void drawFooter(ImDrawList *drawList, ImVec2 dockSpaceSize, float footerHeight) { void drawFooter(ImDrawList *drawList, ImVec2 dockSpaceSize) {
auto dockId = ImGui::DockSpace(ImGui::GetID("ImHexMainDock"), dockSpaceSize); auto dockId = ImGui::DockSpace(ImGui::GetID("ImHexMainDock"), dockSpaceSize);
ImHexApi::System::impl::setMainDockSpaceId(dockId); ImHexApi::System::impl::setMainDockSpaceId(dockId);
drawList->AddRectFilled(ImGui::GetWindowPos(), ImGui::GetWindowPos() + ImGui::GetWindowSize() - ImVec2(dockSpaceSize.x, footerHeight - ImGui::GetStyle().FramePadding.y - 1_scaled), ImGui::GetColorU32(ImGuiCol_MenuBarBg));
ImGui::Separator(); ImGui::Separator();
ImGui::SetCursorPosX(8); ImGui::SetCursorPosX(8);
for (const auto &callback : ContentRegistry::Interface::impl::getFooterItems()) { for (const auto &callback : ContentRegistry::Interface::impl::getFooterItems()) {
@ -499,22 +497,29 @@ namespace hex::plugin::builtin {
const auto dockSpaceSize = ImHexApi::System::getMainWindowSize() - ImVec2(sidebarWidth, menuBarHeight * 2 + footerHeight); const auto dockSpaceSize = ImHexApi::System::getMainWindowSize() - ImVec2(sidebarWidth, menuBarHeight * 2 + footerHeight);
ImGui::SetCursorPosX(sidebarWidth); ImGui::SetCursorPosX(sidebarWidth);
drawFooter(drawList, dockSpaceSize, footerHeight); drawFooter(drawList, dockSpaceSize);
if (shouldDrawSidebar) { if (shouldDrawSidebar) {
// Draw sidebar background and separator
drawList->AddRectFilled(
ImGui::GetWindowPos() - ImVec2(0, ImGui::GetStyle().FramePadding.y + 1_scaled),
ImGui::GetWindowPos() + ImGui::GetWindowSize() - ImVec2(dockSpaceSize.x, footerHeight - ImGui::GetStyle().FramePadding.y + 1_scaled),
ImGui::GetColorU32(ImGuiCol_MenuBarBg)
);
ImGui::SetCursorPos(sidebarPos); ImGui::SetCursorPos(sidebarPos);
drawSidebar(dockSpaceSize, sidebarPos, sidebarWidth); drawSidebar(dockSpaceSize, sidebarPos, sidebarWidth);
if (ImHexApi::Provider::isValid() && isAnyViewOpen()) {
drawList->AddLine(
ImGui::GetWindowPos() + sidebarPos + ImVec2(sidebarWidth - 1_scaled, menuBarHeight - 2_scaled),
ImGui::GetWindowPos() + sidebarPos + ImGui::GetWindowSize() - ImVec2(dockSpaceSize.x + 1_scaled, footerHeight - ImGui::GetStyle().FramePadding.y + 2_scaled + menuBarHeight),
ImGui::GetColorU32(ImGuiCol_Separator));
}
} }
drawMainMenu(menuBarHeight); drawMainMenu(menuBarHeight);
drawToolbar(); drawToolbar();
if (ImHexApi::Provider::isValid() && isAnyViewOpen()) {
drawList->AddLine(
ImGui::GetWindowPos() + sidebarPos + ImVec2(sidebarWidth - 1_scaled, -2_scaled),
ImGui::GetWindowPos() + sidebarPos + ImGui::GetWindowSize() - ImVec2(dockSpaceSize.x + 1_scaled, footerHeight - ImGui::GetStyle().FramePadding.y - 1_scaled + menuBarHeight),
ImGui::GetColorU32(ImGuiCol_Separator));
}
} else { } else {
ImGui::PopStyleVar(2); ImGui::PopStyleVar(2);
} }