Added ability to provide delta to DraggingScrollManager.

This commit is contained in:
23rd 2022-03-14 17:36:51 +03:00
parent 6e6ba5a149
commit 443191045b
2 changed files with 15 additions and 10 deletions

View file

@ -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();
}

View file

@ -17,6 +17,7 @@ class DraggingScrollManager final {
public:
DraggingScrollManager();
void checkDeltaScroll(int delta);
void checkDeltaScroll(const QPoint &point, int top, int bottom);
void cancel();