Support smooth scroll in ListBox

This commit is contained in:
David Capello 2016-11-15 17:31:56 -03:00
parent 1e5ae5e9cb
commit 64af97131d

View File

@ -199,8 +199,14 @@ bool ListBox::onProcessMessage(Message* msg)
case kMouseWheelMessage: {
View* view = View::getView(this);
if (view) {
auto mouseMsg = static_cast<MouseMessage*>(msg);
gfx::Point scroll = view->viewScroll();
scroll += static_cast<MouseMessage*>(msg)->wheelDelta() * textHeight()*3;
if (mouseMsg->preciseWheel())
scroll += mouseMsg->wheelDelta();
else
scroll += mouseMsg->wheelDelta() * textHeight()*3;
view->setViewScroll(scroll);
}
break;