mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
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)
This commit is contained in:
parent
edb9f89456
commit
845f275ae7
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user