mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed smooth scrolling
This commit is contained in:
parent
ee396bc1b8
commit
bc54927c84
3 changed files with 9 additions and 14 deletions
|
@ -95,9 +95,11 @@ TwitchChannel::TwitchChannel(const QString &channelName, Communi::IrcConnection
|
|||
QObject::connect(this->chattersListTimer, &QTimer::timeout, doRefreshChatters);
|
||||
this->chattersListTimer->start(5 * 60 * 1000);
|
||||
|
||||
// for (int i = 0; i < 1000; i++) {
|
||||
// this->addMessage(messages::Message::createSystemMessage("asdf"));
|
||||
// }
|
||||
#if 0
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
this->addMessage(messages::Message::createSystemMessage("asdf"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TwitchChannel::~TwitchChannel()
|
||||
|
|
|
@ -51,8 +51,6 @@ ChannelView::ChannelView(BaseWidget *parent)
|
|||
}));
|
||||
|
||||
this->scrollBar_.getCurrentValueChanged().connect([this] {
|
||||
// qDebug() << "getCurrentValueChanged";
|
||||
|
||||
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView
|
||||
this->actuallyLayoutMessages(true);
|
||||
|
||||
|
@ -192,6 +190,7 @@ void ChannelView::actuallyLayoutMessages(bool causedByScrollbar)
|
|||
this->showingLatestMessages_ = this->scrollBar_.isAtBottom() || !this->scrollBar_.isVisible();
|
||||
|
||||
size_t start = size_t(this->scrollBar_.getCurrentValue());
|
||||
qDebug() << this->scrollBar_.getCurrentValue();
|
||||
int layoutWidth = this->getLayoutWidth();
|
||||
|
||||
MessageElement::Flags flags = this->getFlags();
|
||||
|
@ -285,7 +284,6 @@ QString ChannelView::getSelectedText()
|
|||
return result;
|
||||
}
|
||||
|
||||
qDebug() << "xd >";
|
||||
for (int msg = _selection.selectionMin.messageIndex;
|
||||
msg <= _selection.selectionMax.messageIndex; msg++) {
|
||||
MessageLayoutPtr layout = messagesSnapshot[msg];
|
||||
|
@ -493,7 +491,7 @@ void ChannelView::pause(int msecTimeout)
|
|||
this->pauseTimeout_.stop();
|
||||
this->pauseTimeout_.start(msecTimeout);
|
||||
|
||||
qDebug() << "pause" << msecTimeout;
|
||||
// qDebug() << "pause" << msecTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1157,11 +1155,6 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const messages::Link &link
|
|||
QPoint(int(150 * this->getScale()), int(70 * this->getScale())));
|
||||
userPopup->show();
|
||||
|
||||
// this->userPopupWidget.setName(user);
|
||||
// this->userPopupWidget.moveTo(this, event->screenPos().toPoint());
|
||||
// this->userPopupWidget.show();
|
||||
// this->userPopupWidget.setFocus();
|
||||
|
||||
qDebug() << "Clicked " << user << "s message";
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace widgets {
|
|||
|
||||
Scrollbar::Scrollbar(ChannelView *parent)
|
||||
: BaseWidget(parent)
|
||||
, currentValueAnimation_(this, "currentValue")
|
||||
, currentValueAnimation_(this, "currentValue_")
|
||||
{
|
||||
resize(int(16 * this->getScale()), 100);
|
||||
this->currentValueAnimation_.setDuration(150);
|
||||
|
@ -115,6 +115,7 @@ void Scrollbar::setDesiredValue(qreal value, bool animated)
|
|||
// if (((this->getMaximum() - this->getLargeChange()) - value) <= 0.01) {
|
||||
// value += 1;
|
||||
// }
|
||||
|
||||
this->currentValueAnimation_.setEndValue(value);
|
||||
this->smoothScrollingOffset_ = 0;
|
||||
this->atBottom_ = ((this->getMaximum() - this->getLargeChange()) - value) <= 0.0001;
|
||||
|
@ -191,7 +192,6 @@ void Scrollbar::setCurrentValue(qreal value)
|
|||
value + this->smoothScrollingOffset_));
|
||||
|
||||
if (std::abs(this->currentValue_ - value) > 0.0001) {
|
||||
// qDebug() << "setCurrentValue";
|
||||
this->currentValue_ = value;
|
||||
|
||||
this->updateScroll();
|
||||
|
|
Loading…
Reference in a new issue