Tabs: disable mouse wheel when we are dragging tabs

This commit is contained in:
David Capello 2015-04-24 19:29:57 -03:00
parent c63ccf914f
commit eb60a4c3e7

View File

@ -420,22 +420,24 @@ bool Tabs::onProcessMessage(Message* msg)
}
return true;
case kMouseWheelMessage: {
int dz =
(static_cast<MouseMessage*>(msg)->wheelDelta().x +
static_cast<MouseMessage*>(msg)->wheelDelta().y);
case kMouseWheelMessage:
if (!m_isDragging) {
int dz =
(static_cast<MouseMessage*>(msg)->wheelDelta().x +
static_cast<MouseMessage*>(msg)->wheelDelta().y);
auto it = std::find(m_list.begin(), m_list.end(), m_selected);
if (it != m_list.end()) {
int index = (it - m_list.begin());
int newIndex = index + dz;
newIndex = MID(0, newIndex, int(m_list.size())-1);
if (newIndex != index) {
selectTabInternal(m_list[newIndex]);
auto it = std::find(m_list.begin(), m_list.end(), m_selected);
if (it != m_list.end()) {
int index = (it - m_list.begin());
int newIndex = index + dz;
newIndex = MID(0, newIndex, int(m_list.size())-1);
if (newIndex != index) {
selectTabInternal(m_list[newIndex]);
}
}
return true;
}
return true;
}
break;
case kKeyDownMessage:
case kKeyUpMessage: {