[nostalgia/core/studio] Cleanup, make all number keys after num colors jump to last
All checks were successful
Build / build (push) Successful in 2m32s

This commit is contained in:
Gary Talent 2024-09-28 23:44:12 -05:00
parent b90ab27a65
commit 0daf938f76

View File

@ -254,15 +254,16 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
m_pal, m_page, m_selectedColorRow); m_pal, m_page, m_selectedColorRow);
} }
if (!inputFocused) { if (!inputFocused) {
for (auto i = 0u; i < ox::min<size_t>(10, largestPage(m_pal)); ++i) { auto const lastColor = largestPage(m_pal) - 1;
if (ImGui::IsKeyPressed(ImGuiKey_0, false)) {
m_selectedColorRow = ox::min<size_t>(9, lastColor);
} else for (auto i = 9u; i < 10; --i) {
auto const key = static_cast<ImGuiKey>(ImGuiKey_1 + i); auto const key = static_cast<ImGuiKey>(ImGuiKey_1 + i);
if (ImGui::IsKeyPressed(key, false)) { if (ImGui::IsKeyPressed(key, false)) {
m_selectedColorRow = i; m_selectedColorRow = ox::min<size_t>(i, lastColor);
break;
} }
} }
if (ImGui::IsKeyPressed(ImGuiKey_0, false)) {
m_selectedColorRow = ox::min<size_t>(9, largestPage(m_pal) - 1);
}
} }
auto const newColor = color16(r, g, b, a); auto const newColor = color16(r, g, b, a);
if (c != newColor) { if (c != newColor) {