Handle the scroll wheel changing over scrollbars.
* Extract the scrollbar change based on the mouse wheel delta into a protected method of BView. * Call that method from BScrollBar's MessageReceived. With this change it is now a bit easier to scroll horizontally around the system by putting the mouse cursor over a horizontal scrollbar and using the wheel. Fixes #8631.
This commit is contained in:
@@ -642,6 +642,22 @@ BScrollBar::MessageReceived(BMessage* message)
|
||||
ValueChanged(value);
|
||||
break;
|
||||
}
|
||||
case B_MOUSE_WHEEL_CHANGED:
|
||||
{
|
||||
// Must handle this here since BView checks for the existence of
|
||||
// scrollbars, which a scrollbar itself does not have
|
||||
float deltaX = 0.0f, deltaY = 0.0f;
|
||||
message->FindFloat("be:wheel_delta_x", &deltaX);
|
||||
message->FindFloat("be:wheel_delta_y", &deltaY);
|
||||
|
||||
if (deltaX == 0.0f && deltaY == 0.0f)
|
||||
break;
|
||||
|
||||
if (deltaX != 0.0f && deltaY == 0.0f)
|
||||
deltaY = deltaX;
|
||||
|
||||
ScrollWithMouseWheelDelta(this, deltaY);
|
||||
}
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user