1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

WebScrollBar: Don't update value while slider is down

Makes the scrolling smoother
This commit is contained in:
David Rosca 2016-12-27 12:20:16 +01:00
parent 0ca133bfaf
commit 08af25f4f7

View File

@ -43,23 +43,27 @@ void WebScrollBar::updateValues(const QSize &viewport)
setMinimum(0); setMinimum(0);
setParent(m_view->overlayWidget()); setParent(m_view->overlayWidget());
m_blockScrolling = true; int newValue;
if (orientation() == Qt::Vertical) { if (orientation() == Qt::Vertical) {
setFixedHeight(viewport.height()); setFixedHeight(viewport.height());
move(m_view->width() - width(), 0); move(m_view->width() - width(), 0);
setPageStep(viewport.height()); setPageStep(viewport.height());
setMaximum(std::max(0, m_view->page()->contentsSize().toSize().height() - viewport.height())); setMaximum(std::max(0, m_view->page()->contentsSize().toSize().height() - viewport.height()));
setValue(m_view->page()->scrollPosition().toPoint().y()); newValue = m_view->page()->scrollPosition().toPoint().y();
} else { } else {
setFixedWidth(viewport.width()); setFixedWidth(viewport.width());
move(0, m_view->height() - height()); move(0, m_view->height() - height());
setPageStep(viewport.width()); setPageStep(viewport.width());
setMaximum(std::max(0, m_view->page()->contentsSize().toSize().width() - viewport.width())); setMaximum(std::max(0, m_view->page()->contentsSize().toSize().width() - viewport.width()));
setValue(m_view->page()->scrollPosition().toPoint().x()); newValue = m_view->page()->scrollPosition().toPoint().x();
} }
m_blockScrolling = false; if (!isSliderDown()) {
m_blockScrolling = true;
setValue(newValue);
m_blockScrolling = false;
}
setVisible(maximum() > minimum()); setVisible(maximum() > minimum());
} }