mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
selections now render over all images
This commit is contained in:
parent
eb26b1fbb3
commit
3ba55ee511
3 changed files with 17 additions and 17 deletions
|
@ -166,6 +166,11 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection
|
|||
painter.fillRect(0, y, pixmap->width(), pixmap->height(), themeManager.messages.disabled);
|
||||
}
|
||||
|
||||
// draw selection
|
||||
if (!selection.isEmpty()) {
|
||||
this->container.paintSelection(painter, messageIndex, selection, y);
|
||||
}
|
||||
|
||||
// draw last read message line
|
||||
if (isLastReadMessage) {
|
||||
QColor color = isWindowFocused ? themeManager.tabs.selected.backgrounds.regular.color()
|
||||
|
@ -193,11 +198,6 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int messageIndex, Selection &s
|
|||
? themeManager.messages.backgrounds.highlighted
|
||||
: themeManager.messages.backgrounds.regular);
|
||||
|
||||
// draw selection
|
||||
if (!selection.isEmpty()) {
|
||||
this->container.paintSelection(painter, messageIndex, selection);
|
||||
}
|
||||
|
||||
// draw message
|
||||
this->container.paintElements(painter);
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ void MessageLayoutContainer::paintAnimatedElements(QPainter &painter, int yOffse
|
|||
}
|
||||
|
||||
void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
||||
Selection &selection)
|
||||
Selection &selection, int yOffset)
|
||||
{
|
||||
singletons::ThemeManager &themeManager = singletons::ThemeManager::getInstance();
|
||||
QColor selectionColor = themeManager.messages.selection;
|
||||
|
@ -211,8 +211,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||
for (Line &line : this->lines) {
|
||||
QRect rect = line.rect;
|
||||
|
||||
rect.setTop(std::max(0, rect.top()));
|
||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
||||
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
||||
|
||||
|
@ -270,8 +270,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||
Line &line = this->lines[lineIndex2];
|
||||
QRect rect = line.rect;
|
||||
|
||||
rect.setTop(std::max(0, rect.top()));
|
||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
||||
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
||||
|
||||
|
@ -290,8 +290,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||
|
||||
QRect rect = line.rect;
|
||||
|
||||
rect.setTop(std::max(0, rect.top()));
|
||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
||||
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||
rect.setLeft(x);
|
||||
rect.setRight(r);
|
||||
|
||||
|
@ -316,8 +316,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||
if (line.endCharIndex < /*=*/selection.max.charIndex) {
|
||||
QRect rect = line.rect;
|
||||
|
||||
rect.setTop(std::max(0, rect.top()));
|
||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
||||
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
||||
|
||||
|
@ -340,8 +340,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||
|
||||
QRect rect = line.rect;
|
||||
|
||||
rect.setTop(std::max(0, rect.top()));
|
||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
||||
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||
rect.setRight(r);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ struct MessageLayoutContainer {
|
|||
// painting
|
||||
void paintElements(QPainter &painter);
|
||||
void paintAnimatedElements(QPainter &painter, int yOffset);
|
||||
void paintSelection(QPainter &painter, int messageIndex, Selection &selection);
|
||||
void paintSelection(QPainter &painter, int messageIndex, Selection &selection, int yOffset);
|
||||
|
||||
// selection
|
||||
int getSelectionIndex(QPoint point);
|
||||
|
|
Loading…
Reference in a new issue