fixed "jump to bottom" now disapearing after click

This commit is contained in:
fourtf 2017-12-26 17:15:23 +01:00
parent a51735baae
commit 285c72a83d
2 changed files with 6 additions and 7 deletions

View file

@ -45,7 +45,6 @@ ChannelView::ChannelView(BaseWidget *parent)
this->scrollBar.getCurrentValueChanged().connect([this] { this->scrollBar.getCurrentValueChanged().connect([this] {
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView // Whenever the scrollbar value has been changed, re-render the ChatWidgetView
this->layoutMessages(); this->layoutMessages();
this->goToBottom->setVisible(this->scrollBar.isVisible() && !this->scrollBar.isAtBottom()); this->goToBottom->setVisible(this->scrollBar.isVisible() && !this->scrollBar.isAtBottom());
this->queueUpdate(); this->queueUpdate();
@ -93,13 +92,13 @@ ChannelView::~ChannelView()
void ChannelView::queueUpdate() void ChannelView::queueUpdate()
{ {
if (this->updateTimer.isActive()) { // if (this->updateTimer.isActive()) {
this->updateQueued = true; // this->updateQueued = true;
} // }
update(); update();
this->updateTimer.start(); // this->updateTimer.start();
} }
void ChannelView::layoutMessages() void ChannelView::layoutMessages()

View file

@ -130,19 +130,19 @@ void ScrollBar::setDesiredValue(qreal value, bool animated)
// } // }
this->currentValueAnimation.setEndValue(value); this->currentValueAnimation.setEndValue(value);
this->smoothScrollingOffset = 0; this->smoothScrollingOffset = 0;
this->atBottom = ((this->getMaximum() - this->getLargeChange()) - value) <= 0.01;
this->currentValueAnimation.start(); this->currentValueAnimation.start();
} else { } else {
if (this->currentValueAnimation.state() != QPropertyAnimation::Running) { if (this->currentValueAnimation.state() != QPropertyAnimation::Running) {
this->smoothScrollingOffset = 0; this->smoothScrollingOffset = 0;
this->desiredValue = value; this->desiredValue = value;
this->currentValueAnimation.stop(); this->currentValueAnimation.stop();
this->atBottom = ((this->getMaximum() - this->getLargeChange()) - value) <= 0.01;
setCurrentValue(value); setCurrentValue(value);
} }
} }
} }
this->atBottom = ((this->getMaximum() - this->getLargeChange()) - value) <= 0.01;
this->smoothScrollingOffset = 0; this->smoothScrollingOffset = 0;
this->desiredValue = value; this->desiredValue = value;
} }