mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-22 06:41:08 +00:00
Fix problems changing HSV/HSL color sliders with mouse wheel
When we change HSV/HSL sliders, the RGB color is calculated and all sliders are re-updated from that color. As HSV/HSL are floating point values, there might be a small adjustment in the 0-100 conversion for the sliders, so we have to lock the changed slider to keep its original value set from the mouse wheel. Fix: https://community.aseprite.org/t/1411
This commit is contained in:
parent
7c19744798
commit
3704bb4093
@ -230,6 +230,7 @@ ColorSliders::ColorSliders()
|
|||||||
, m_items(int(Channel::Channels))
|
, m_items(int(Channel::Channels))
|
||||||
, m_grid(3, false)
|
, m_grid(3, false)
|
||||||
, m_mode(Mode::Absolute)
|
, m_mode(Mode::Absolute)
|
||||||
|
, m_lockSlider(-1)
|
||||||
, m_lockEntry(-1)
|
, m_lockEntry(-1)
|
||||||
, m_color(app::Color::fromMask())
|
, m_color(app::Color::fromMask())
|
||||||
{
|
{
|
||||||
@ -389,12 +390,18 @@ void ColorSliders::addSlider(const Channel channel,
|
|||||||
|
|
||||||
void ColorSliders::setAbsSliderValue(const Channel i, int value)
|
void ColorSliders::setAbsSliderValue(const Channel i, int value)
|
||||||
{
|
{
|
||||||
|
if (m_lockSlider == i)
|
||||||
|
return;
|
||||||
|
|
||||||
m_items[i].absSlider->setValue(value);
|
m_items[i].absSlider->setValue(value);
|
||||||
updateEntryText(i);
|
updateEntryText(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorSliders::setRelSliderValue(const Channel i, int value)
|
void ColorSliders::setRelSliderValue(const Channel i, int value)
|
||||||
{
|
{
|
||||||
|
if (m_lockSlider == i)
|
||||||
|
return;
|
||||||
|
|
||||||
m_items[i].relSlider->setValue(value);
|
m_items[i].relSlider->setValue(value);
|
||||||
updateEntryText(i);
|
updateEntryText(i);
|
||||||
}
|
}
|
||||||
@ -427,6 +434,8 @@ void ColorSliders::syncRelHsvHslSliders()
|
|||||||
|
|
||||||
void ColorSliders::onSliderChange(const Channel i)
|
void ColorSliders::onSliderChange(const Channel i)
|
||||||
{
|
{
|
||||||
|
base::ScopedValue<int> lock(m_lockSlider, i, m_lockSlider);
|
||||||
|
|
||||||
updateEntryText(i);
|
updateEntryText(i);
|
||||||
onControlChange(i);
|
onControlChange(i);
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ namespace app {
|
|||||||
std::vector<Item> m_items;
|
std::vector<Item> m_items;
|
||||||
ui::Grid m_grid;
|
ui::Grid m_grid;
|
||||||
Mode m_mode;
|
Mode m_mode;
|
||||||
|
int m_lockSlider;
|
||||||
int m_lockEntry;
|
int m_lockEntry;
|
||||||
app::Color m_color;
|
app::Color m_color;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user