mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 19:21:12 +00:00
Fix Alt+mouse wheel to navigate color indexes in RGB images/colors (fix #1153)
This commit is contained in:
parent
9748894a26
commit
ec15ec7bb2
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -74,24 +74,18 @@ void ChangeColorCommand::onExecute(Context* context)
|
||||
case None:
|
||||
// do nothing
|
||||
break;
|
||||
case IncrementIndex:
|
||||
if (color.getType() == app::Color::IndexType) {
|
||||
int index = color.getIndex();
|
||||
if (index < get_current_palette()->size()-1)
|
||||
color = app::Color::fromIndex(index+1);
|
||||
}
|
||||
else
|
||||
color = app::Color::fromIndex(0);
|
||||
case IncrementIndex: {
|
||||
int index = color.getIndex();
|
||||
if (index < get_current_palette()->size()-1)
|
||||
color = app::Color::fromIndex(index+1);
|
||||
break;
|
||||
case DecrementIndex:
|
||||
if (color.getType() == app::Color::IndexType) {
|
||||
int index = color.getIndex();
|
||||
if (index > 0)
|
||||
color = app::Color::fromIndex(index-1);
|
||||
}
|
||||
else
|
||||
color = app::Color::fromIndex(0);
|
||||
}
|
||||
case DecrementIndex: {
|
||||
int index = color.getIndex();
|
||||
if (index > 0)
|
||||
color = app::Color::fromIndex(index-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_background)
|
||||
|
@ -98,26 +98,18 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
|
||||
|
||||
case WHEEL_FG:
|
||||
{
|
||||
int newIndex = 0;
|
||||
if (ColorBar::instance()->getFgColor().getType() == app::Color::IndexType) {
|
||||
int lastIndex = get_current_palette()->size()-1;
|
||||
|
||||
newIndex = ColorBar::instance()->getFgColor().getIndex() + int(dz);
|
||||
newIndex = MID(0, newIndex, lastIndex);
|
||||
}
|
||||
int lastIndex = get_current_palette()->size()-1;
|
||||
int newIndex = ColorBar::instance()->getFgColor().getIndex() + int(dz);
|
||||
newIndex = MID(0, newIndex, lastIndex);
|
||||
ColorBar::instance()->setFgColor(app::Color::fromIndex(newIndex));
|
||||
}
|
||||
break;
|
||||
|
||||
case WHEEL_BG:
|
||||
{
|
||||
int newIndex = 0;
|
||||
if (ColorBar::instance()->getBgColor().getType() == app::Color::IndexType) {
|
||||
int lastIndex = get_current_palette()->size()-1;
|
||||
|
||||
newIndex = ColorBar::instance()->getBgColor().getIndex() + int(dz);
|
||||
newIndex = MID(0, newIndex, lastIndex);
|
||||
}
|
||||
int lastIndex = get_current_palette()->size()-1;
|
||||
int newIndex = ColorBar::instance()->getBgColor().getIndex() + int(dz);
|
||||
newIndex = MID(0, newIndex, lastIndex);
|
||||
ColorBar::instance()->setBgColor(app::Color::fromIndex(newIndex));
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user