mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Fixed double clicking sometimes turning into unwanted triple-clicking.
This commit is contained in:
parent
39ee6efffc
commit
f13f99bb42
1 changed files with 13 additions and 12 deletions
|
@ -1018,7 +1018,6 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
|
||||||
|
|
||||||
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex)) {
|
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex)) {
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
|
|
||||||
auto messagesSnapshot = this->getMessagesSnapshot();
|
auto messagesSnapshot = this->getMessagesSnapshot();
|
||||||
if (messagesSnapshot.getLength() == 0) {
|
if (messagesSnapshot.getLength() == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -1072,18 +1071,19 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
this->dCSelection_.selectingLeft = this->dCSelection_.selectingRight =
|
this->dCSelection_.selectingLeft = this->dCSelection_.selectingRight =
|
||||||
false;
|
false;
|
||||||
if (this->isMouseDown_) {
|
if (this->isDoubleClick_) {
|
||||||
this->isMouseDown_ = false;
|
|
||||||
|
|
||||||
if (fabsf(distanceBetweenPoints(this->lastPressPosition_,
|
|
||||||
event->screenPos())) > 15.f) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (this->isDoubleClick_) {
|
|
||||||
this->isDoubleClick_ = false;
|
this->isDoubleClick_ = false;
|
||||||
// Was actually not a wanted triple-click
|
// Was actually not a wanted triple-click
|
||||||
if (fabsf(distanceBetweenPoints(this->lastDClickPosition_,
|
if (fabsf(distanceBetweenPoints(this->lastDClickPosition_,
|
||||||
event->screenPos())) > 10.f) {
|
event->screenPos())) > 10.f) {
|
||||||
|
this->clickTimer_->stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (this->isMouseDown_) {
|
||||||
|
this->isMouseDown_ = false;
|
||||||
|
|
||||||
|
if (fabsf(distanceBetweenPoints(this->lastPressPosition_,
|
||||||
|
event->screenPos())) > 15.f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1104,7 +1104,6 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
// not left or right button
|
// not left or right button
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find message
|
// find message
|
||||||
this->layoutMessages();
|
this->layoutMessages();
|
||||||
|
|
||||||
|
@ -1129,10 +1128,12 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
|
||||||
const MessageLayoutElement *hoverLayoutElement =
|
const MessageLayoutElement *hoverLayoutElement =
|
||||||
layout->getElementAt(relativePos);
|
layout->getElementAt(relativePos);
|
||||||
|
|
||||||
// Triple-clicking a message selects the whole message
|
// Triple-clicking a message selects the whole message
|
||||||
if (this->clickTimer_->isActive() && this->selecting_) {
|
if (this->clickTimer_->isActive() && this->selecting_) {
|
||||||
this->selectWholeMessage(layout.get(), messageIndex);
|
if (fabsf(distanceBetweenPoints(this->lastDClickPosition_,
|
||||||
|
event->screenPos())) < 10.f) {
|
||||||
|
this->selectWholeMessage(layout.get(), messageIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hoverLayoutElement == nullptr) {
|
if (hoverLayoutElement == nullptr) {
|
||||||
|
|
Loading…
Reference in a new issue