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);
|
QObject::connect(this->chattersListTimer, &QTimer::timeout, doRefreshChatters);
|
||||||
this->chattersListTimer->start(5 * 60 * 1000);
|
this->chattersListTimer->start(5 * 60 * 1000);
|
||||||
|
|
||||||
// for (int i = 0; i < 1000; i++) {
|
#if 0
|
||||||
// this->addMessage(messages::Message::createSystemMessage("asdf"));
|
for (int i = 0; i < 1000; i++) {
|
||||||
// }
|
this->addMessage(messages::Message::createSystemMessage("asdf"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TwitchChannel::~TwitchChannel()
|
TwitchChannel::~TwitchChannel()
|
||||||
|
|
|
@ -51,8 +51,6 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this->scrollBar_.getCurrentValueChanged().connect([this] {
|
this->scrollBar_.getCurrentValueChanged().connect([this] {
|
||||||
// qDebug() << "getCurrentValueChanged";
|
|
||||||
|
|
||||||
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView
|
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView
|
||||||
this->actuallyLayoutMessages(true);
|
this->actuallyLayoutMessages(true);
|
||||||
|
|
||||||
|
@ -192,6 +190,7 @@ void ChannelView::actuallyLayoutMessages(bool causedByScrollbar)
|
||||||
this->showingLatestMessages_ = this->scrollBar_.isAtBottom() || !this->scrollBar_.isVisible();
|
this->showingLatestMessages_ = this->scrollBar_.isAtBottom() || !this->scrollBar_.isVisible();
|
||||||
|
|
||||||
size_t start = size_t(this->scrollBar_.getCurrentValue());
|
size_t start = size_t(this->scrollBar_.getCurrentValue());
|
||||||
|
qDebug() << this->scrollBar_.getCurrentValue();
|
||||||
int layoutWidth = this->getLayoutWidth();
|
int layoutWidth = this->getLayoutWidth();
|
||||||
|
|
||||||
MessageElement::Flags flags = this->getFlags();
|
MessageElement::Flags flags = this->getFlags();
|
||||||
|
@ -285,7 +284,6 @@ QString ChannelView::getSelectedText()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "xd >";
|
|
||||||
for (int msg = _selection.selectionMin.messageIndex;
|
for (int msg = _selection.selectionMin.messageIndex;
|
||||||
msg <= _selection.selectionMax.messageIndex; msg++) {
|
msg <= _selection.selectionMax.messageIndex; msg++) {
|
||||||
MessageLayoutPtr layout = messagesSnapshot[msg];
|
MessageLayoutPtr layout = messagesSnapshot[msg];
|
||||||
|
@ -493,7 +491,7 @@ void ChannelView::pause(int msecTimeout)
|
||||||
this->pauseTimeout_.stop();
|
this->pauseTimeout_.stop();
|
||||||
this->pauseTimeout_.start(msecTimeout);
|
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())));
|
QPoint(int(150 * this->getScale()), int(70 * this->getScale())));
|
||||||
userPopup->show();
|
userPopup->show();
|
||||||
|
|
||||||
// this->userPopupWidget.setName(user);
|
|
||||||
// this->userPopupWidget.moveTo(this, event->screenPos().toPoint());
|
|
||||||
// this->userPopupWidget.show();
|
|
||||||
// this->userPopupWidget.setFocus();
|
|
||||||
|
|
||||||
qDebug() << "Clicked " << user << "s message";
|
qDebug() << "Clicked " << user << "s message";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace widgets {
|
||||||
|
|
||||||
Scrollbar::Scrollbar(ChannelView *parent)
|
Scrollbar::Scrollbar(ChannelView *parent)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, currentValueAnimation_(this, "currentValue")
|
, currentValueAnimation_(this, "currentValue_")
|
||||||
{
|
{
|
||||||
resize(int(16 * this->getScale()), 100);
|
resize(int(16 * this->getScale()), 100);
|
||||||
this->currentValueAnimation_.setDuration(150);
|
this->currentValueAnimation_.setDuration(150);
|
||||||
|
@ -115,6 +115,7 @@ void Scrollbar::setDesiredValue(qreal value, bool animated)
|
||||||
// if (((this->getMaximum() - this->getLargeChange()) - value) <= 0.01) {
|
// if (((this->getMaximum() - this->getLargeChange()) - value) <= 0.01) {
|
||||||
// value += 1;
|
// value += 1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this->currentValueAnimation_.setEndValue(value);
|
this->currentValueAnimation_.setEndValue(value);
|
||||||
this->smoothScrollingOffset_ = 0;
|
this->smoothScrollingOffset_ = 0;
|
||||||
this->atBottom_ = ((this->getMaximum() - this->getLargeChange()) - value) <= 0.0001;
|
this->atBottom_ = ((this->getMaximum() - this->getLargeChange()) - value) <= 0.0001;
|
||||||
|
@ -191,7 +192,6 @@ void Scrollbar::setCurrentValue(qreal value)
|
||||||
value + this->smoothScrollingOffset_));
|
value + this->smoothScrollingOffset_));
|
||||||
|
|
||||||
if (std::abs(this->currentValue_ - value) > 0.0001) {
|
if (std::abs(this->currentValue_ - value) > 0.0001) {
|
||||||
// qDebug() << "setCurrentValue";
|
|
||||||
this->currentValue_ = value;
|
this->currentValue_ = value;
|
||||||
|
|
||||||
this->updateScroll();
|
this->updateScroll();
|
||||||
|
|
Loading…
Reference in a new issue