Skip to content

Commit

Permalink
Issue #142: Cannot reach the top
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubMelka committed Jan 5, 2024
1 parent ca69815 commit 843c025
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Pdf4QtLibWidgets/sources/pdfdrawwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,14 @@ void PDFDrawWidgetBase<BaseWidget>::wheelEvent(QWheelEvent* event)
// We must move to another block (we are in block mode)
bool up = scrollByPixels.y() > 0;

m_widget->getVerticalScrollbar()->setValue(m_widget->getVerticalScrollbar()->value() + (up ? -1 : 1));
proxy->scrollByPixels(QPoint(0, up ? std::numeric_limits<int>::min() : std::numeric_limits<int>::max()));
QScrollBar* verticalScrollbar = m_widget->getVerticalScrollbar();
const int newValue = verticalScrollbar->value() + (up ? -1 : 1);

if (newValue >= verticalScrollbar->minimum() && newValue <= verticalScrollbar->maximum())
{
verticalScrollbar->setValue(newValue);
proxy->scrollByPixels(QPoint(0, up ? std::numeric_limits<int>::min() : std::numeric_limits<int>::max()));
}
}
}

Expand Down
1 change: 1 addition & 0 deletions RELEASES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CURRENT:
- Issue #142: Cannot reach the top
- Issue #141: Save button in toolbar
- Issue #140: New bookmarks created empty?
- Issue #139: Changing page layout reset the current page
Expand Down

0 comments on commit 843c025

Please sign in to comment.