mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-07 09:56:59 +00:00
Avoid continuous redrawing events when moving mouse on Edit > Preferences listbox of sections
This commit is contained in:
parent
ca252f9f02
commit
a0bea17bc0
@ -91,6 +91,8 @@ Widget* ListBox::getChildByIndex(int index)
|
||||
|
||||
void ListBox::selectChild(Widget* item, Message* msg)
|
||||
{
|
||||
bool didChange = false;
|
||||
|
||||
int itemIndex = getChildIndex(item);
|
||||
m_lastSelectedIndex = itemIndex;
|
||||
|
||||
@ -107,7 +109,10 @@ void ListBox::selectChild(Widget* item, Message* msg)
|
||||
bool state = child->isSelected();
|
||||
if (msg && !msg->ctrlPressed() && !msg->cmdPressed())
|
||||
state = false;
|
||||
m_states[i] = state;
|
||||
if (m_states[i] != state) {
|
||||
didChange = true;
|
||||
m_states[i] = state;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@ -130,8 +135,10 @@ void ListBox::selectChild(Widget* item, Message* msg)
|
||||
newState = (child == item);
|
||||
}
|
||||
|
||||
if (child->isSelected() != newState)
|
||||
if (child->isSelected() != newState) {
|
||||
didChange = true;
|
||||
child->setSelected(newState);
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
@ -139,7 +146,8 @@ void ListBox::selectChild(Widget* item, Message* msg)
|
||||
if (item)
|
||||
makeChildVisible(item);
|
||||
|
||||
onChange();
|
||||
if (didChange)
|
||||
onChange();
|
||||
}
|
||||
|
||||
void ListBox::selectIndex(int index, Message* msg)
|
||||
|
Loading…
Reference in New Issue
Block a user