From 0daf938f765b3a3ce8ba7fb292572a6a5a004634 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 28 Sep 2024 23:44:12 -0500 Subject: [PATCH] [nostalgia/core/studio] Cleanup, make all number keys after num colors jump to last --- .../src/studio/paletteeditor/paletteeditor-imgui.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp index f39fb950..ebf079a0 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -254,15 +254,16 @@ void PaletteEditorImGui::drawColorEditor() noexcept { m_pal, m_page, m_selectedColorRow); } if (!inputFocused) { - for (auto i = 0u; i < ox::min(10, largestPage(m_pal)); ++i) { + auto const lastColor = largestPage(m_pal) - 1; + if (ImGui::IsKeyPressed(ImGuiKey_0, false)) { + m_selectedColorRow = ox::min(9, lastColor); + } else for (auto i = 9u; i < 10; --i) { auto const key = static_cast(ImGuiKey_1 + i); if (ImGui::IsKeyPressed(key, false)) { - m_selectedColorRow = i; + m_selectedColorRow = ox::min(i, lastColor); + break; } } - if (ImGui::IsKeyPressed(ImGuiKey_0, false)) { - m_selectedColorRow = ox::min(9, largestPage(m_pal) - 1); - } } auto const newColor = color16(r, g, b, a); if (c != newColor) {