diff --git a/ui/dragging_scroll_manager.cpp b/ui/dragging_scroll_manager.cpp index e62d3a3..5df4ee5 100644 --- a/ui/dragging_scroll_manager.cpp +++ b/ui/dragging_scroll_manager.cpp @@ -22,16 +22,8 @@ void DraggingScrollManager::scrollByTimer() { _scrolls.fire_copy(d); } -void DraggingScrollManager::checkDeltaScroll( - const QPoint &point, - int top, - int bottom) { - const auto diff = point.y() - top; - _delta = (diff < 0) - ? diff - : (point.y() >= bottom) - ? (point.y() - bottom + 1) - : 0; +void DraggingScrollManager::checkDeltaScroll(int delta) { + _delta = delta; if (_delta) { _timer.callEach(15); } else { @@ -39,6 +31,18 @@ void DraggingScrollManager::checkDeltaScroll( } } +void DraggingScrollManager::checkDeltaScroll( + const QPoint &point, + int top, + int bottom) { + const auto diff = point.y() - top; + checkDeltaScroll((diff < 0) + ? diff + : (point.y() >= bottom) + ? (point.y() - bottom + 1) + : 0); +} + void DraggingScrollManager::cancel() { _timer.cancel(); } diff --git a/ui/dragging_scroll_manager.h b/ui/dragging_scroll_manager.h index 5102bff..0d73b95 100644 --- a/ui/dragging_scroll_manager.h +++ b/ui/dragging_scroll_manager.h @@ -17,6 +17,7 @@ class DraggingScrollManager final { public: DraggingScrollManager(); + void checkDeltaScroll(int delta); void checkDeltaScroll(const QPoint &point, int top, int bottom); void cancel();