Slower scrolling for dropdown lists and scrollbars

This commit is contained in:
pelya
2014-07-20 00:35:07 +03:00
committed by Sergii Pylypenko
parent 6c9fffd545
commit 17f0f3d650
4 changed files with 11 additions and 5 deletions

View File

@@ -105,7 +105,7 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
/* Pressing the upper button? */
SetBit(sb->disp_flags, NDB_SCROLLBAR_UP);
if (_scroller_click_timeout <= 1) {
_scroller_click_timeout = 3;
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
sb->UpdatePosition(rtl ? 1 : -1);
}
w->scrolling_scrollbar = sb->index;
@@ -114,7 +114,7 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
SetBit(sb->disp_flags, NDB_SCROLLBAR_DOWN);
if (_scroller_click_timeout <= 1) {
_scroller_click_timeout = 3;
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
sb->UpdatePosition(rtl ? -1 : 1);
}
w->scrolling_scrollbar = sb->index;

View File

@@ -260,8 +260,11 @@ struct DropdownWindow : Window {
if (this->scrolling != 0) {
int pos = this->vscroll->GetPosition();
this->vscroll->UpdatePosition(this->scrolling);
this->scrolling = 0;
if (_scroller_click_timeout <= 1) {
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
this->vscroll->UpdatePosition(this->scrolling);
this->scrolling = 0;
}
if (pos != this->vscroll->GetPosition()) {
this->SetDirty();

View File

@@ -2398,7 +2398,7 @@ static EventState HandleScrollbarScrolling()
if (sb->disp_flags & ND_SCROLLBAR_BTN) {
if (_scroller_click_timeout == 1) {
_scroller_click_timeout = 3;
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
sb->UpdatePosition(rtl == HasBit(sb->disp_flags, NDB_SCROLLBAR_UP) ? 1 : -1);
w->SetDirty();
}

View File

@@ -885,6 +885,9 @@ extern Point _cursorpos_drag_start;
extern int _scrollbar_start_pos;
extern int _scrollbar_size;
extern byte _scroller_click_timeout;
enum {
SCROLLER_CLICK_DELAY = 6 ///< Delay in video frames between scrollbar doing scroll, we don't want to get to the bottom of the list in an instant
};
extern bool _scrolling_viewport;
extern bool _mouse_hovering;