Make ScrollingRect key-binds only work when mouse is inside. (This is subject to change)
This commit is contained in:
@@ -119,29 +119,30 @@ bool ScrollingRect::ObserveKeyInput(Key key, bool pressed) {
|
||||
if (Widget::ObserveKeyInput(key, pressed))
|
||||
return true;
|
||||
|
||||
if (IsMouseInside()) {
|
||||
if (key == Keys::UpArrow && pressed)
|
||||
{
|
||||
Scroll(-scroll_amount);
|
||||
return true;
|
||||
}
|
||||
if (key == Keys::DownArrow && pressed)
|
||||
{
|
||||
Scroll(scroll_amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == Keys::PageDown && pressed) {
|
||||
ScrollToBottom();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == Keys::PageUp && pressed) {
|
||||
ScrollToTop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// TODO: Forego this in favor of mouse scrolling and clicking.
|
||||
|
||||
if (key == Keys::UpArrow && pressed)
|
||||
{
|
||||
Scroll(-scroll_amount);
|
||||
return true;
|
||||
}
|
||||
if (key == Keys::DownArrow && pressed)
|
||||
{
|
||||
Scroll(scroll_amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == Keys::PageDown && pressed) {
|
||||
ScrollToBottom();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == Keys::PageUp && pressed) {
|
||||
ScrollToTop();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user