From 845f275ae7e962d4b267c5d73f953878267b0196 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 1 Sep 2021 10:38:35 -0300 Subject: [PATCH] Enable cycling colors when palette size=1 so RGB/HSV colors are converted to index=0 anyway In this way after ChangeColor command to increase/decrease an index is used, we always got an index selected (even index=0 if palette size=1) --- src/app/commands/cmd_change_color.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/commands/cmd_change_color.cpp b/src/app/commands/cmd_change_color.cpp index 4c88c8051..076bc836b 100644 --- a/src/app/commands/cmd_change_color.cpp +++ b/src/app/commands/cmd_change_color.cpp @@ -76,7 +76,7 @@ void ChangeColorCommand::onExecute(Context* context) break; case IncrementIndex: { const int palSize = get_current_palette()->size(); - if (palSize > 1) { + if (palSize >= 1) { // Seems safe to assume getIndex() will return a // positive number, so use truncation modulo. color = app::Color::fromIndex((color.getIndex() + 1) % palSize); @@ -85,7 +85,7 @@ void ChangeColorCommand::onExecute(Context* context) } case DecrementIndex: { const int palSize = get_current_palette()->size(); - if (palSize > 1) { + if (palSize >= 1) { // Floor modulo. color = app::Color::fromIndex(((color.getIndex() - 1) % palSize + palSize) % palSize); }