From 721f8442144e20b5c0e29c8f3d0bb008a2c3aa5a Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 18 Jan 2025 20:08:09 -0600 Subject: [PATCH] [nostalgia/core/studio/tilesheeteditor] Fix subsheet and palette scrolling --- .../tilesheeteditor/tilesheeteditor-imgui.cpp | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index ccce34e3..f5717a54 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -234,7 +234,7 @@ void TileSheetEditorImGui::draw(studio::StudioContext&) noexcept { ImGui::BeginChild("SubSheets", {s_palViewWidth - 24, ySize / 2.f}, true); { static constexpr auto btnHeight = ig::BtnSz.y; - auto const btnSize = ImVec2{btnHeight, btnHeight}; + auto constexpr btnSize = ImVec2{btnHeight, btnHeight}; if (ig::PushButton("+", btnSize)) { auto insertOnIdx = m_model.activeSubSheetIdx(); auto const&parent = m_model.activeSubSheet(); @@ -258,16 +258,19 @@ void TileSheetEditorImGui::draw(studio::StudioContext&) noexcept { m_exportMenu.show(); } TileSheet::SubSheetIdx path; - static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody; - if (ImGui::BeginTable("Subsheets", 4, flags)) { - ImGui::TableSetupColumn("Subsheet", ImGuiTableColumnFlags_NoHide); - ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed, 25); - ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50); - ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50); - ImGui::TableHeadersRow(); - drawSubsheetSelector(m_view.img().subsheet, path); - ImGui::EndTable(); - } + static constexpr auto flags = + ImGuiTableFlags_RowBg | + ImGuiTableFlags_NoBordersInBody | + ImGuiTableFlags_ScrollY; + if (ImGui::BeginTable("Subsheets", 4, flags)) { + ImGui::TableSetupColumn("Subsheet", ImGuiTableColumnFlags_NoHide); + ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed, 25); + ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50); + ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50); + ImGui::TableHeadersRow(); + drawSubsheetSelector(m_view.img().subsheet, path); + ImGui::EndTable(); + } } ImGui::EndChild(); } @@ -462,8 +465,12 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept { } } // header + auto constexpr palTblFlags = + ImGuiTableFlags_RowBg | + ImGuiTableFlags_SizingStretchProp | + ImGuiTableFlags_ScrollY; if (ImGui::BeginTable( - "PaletteTable", 4, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp)) { + "PaletteTable", 4, palTblFlags)) { ImGui::TableSetupColumn("Idx", 0, 0.6f); ImGui::TableSetupColumn("", 0, 0.22f); ImGui::TableSetupColumn("Name", 0, 3);