Commit 82e3b576 authored by Johannes Braun's avatar Johannes Braun
Browse files

Fix tabs having a padding

parent 3ea91018
......@@ -714,8 +714,8 @@ void Editor::drawSettings()
glBlitNamedFramebuffer(
0, m_previewFramebuffer->id(), 0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8, 4));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(16, 8));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
ImGui::Begin("Scene");
{
enum class Tab
......@@ -725,11 +725,15 @@ void Editor::drawSettings()
RENDERING
};
static int current_tab = 0;
const auto w = ImGui::GetContentRegionAvailWidth() / 3.f - 12.f;
const auto w = ImGui::GetWindowWidth() / 3.f;
const auto tab_item = [w](const char* name, int item, int& current) {
bool selected = current != item;
if(ImGui::Selectable(name, &selected, 0, ImVec2(w, 0)))
bool selected = current == item;
if (selected)
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if(ImGui::Button(name, ImVec2(w, 0)))
current = item;
if (selected)
ImGui::PopStyleColor();
};
tab_item("Fields", 0, current_tab);
ImGui::SameLine();
......@@ -738,6 +742,7 @@ void Editor::drawSettings()
tab_item("Rendering", 2, current_tab);
ImGui::PopStyleVar(2);
ImGui::BeginChild("CONTENT", ImVec2{}, false, ImGuiWindowFlags_AlwaysUseWindowPadding);
switch(Tab(current_tab))
{
case Tab::FIELDS:
......@@ -752,6 +757,7 @@ void Editor::drawSettings()
drawRenderingTab();
break;
}
ImGui::EndChild();
}
ImGui::End();
processInputsMain();
......@@ -1056,7 +1062,7 @@ void Editor::drawMenuBar()
ImGui::Separator();
if (ImGui::MenuItem("Exit", "Alt+F4"))
{
exit(0);
}
ImGui::EndMenu();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment