mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Avoid continuous redrawing events when moving mouse on Edit > Preferences listbox of sections
This commit is contained in:
parent
5dffcc384a
commit
459d21ac4c
@ -92,6 +92,8 @@ Widget* ListBox::getChildByIndex(int index)
|
||||
|
||||
void ListBox::selectChild(Widget* item, Message* msg)
|
||||
{
|
||||
bool didChange = false;
|
||||
|
||||
int itemIndex = getChildIndex(item);
|
||||
m_lastSelectedIndex = itemIndex;
|
||||
|
||||
@ -108,7 +110,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;
|
||||
}
|
||||
}
|
||||
@ -131,8 +136,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;
|
||||
}
|
||||
@ -140,7 +147,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