selections now render over all images
This commit is contained in:
@@ -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);
|
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
|
// draw last read message line
|
||||||
if (isLastReadMessage) {
|
if (isLastReadMessage) {
|
||||||
QColor color = isWindowFocused ? themeManager.tabs.selected.backgrounds.regular.color()
|
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.highlighted
|
||||||
: themeManager.messages.backgrounds.regular);
|
: themeManager.messages.backgrounds.regular);
|
||||||
|
|
||||||
// draw selection
|
|
||||||
if (!selection.isEmpty()) {
|
|
||||||
this->container.paintSelection(painter, messageIndex, selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw message
|
// draw message
|
||||||
this->container.paintElements(painter);
|
this->container.paintElements(painter);
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ void MessageLayoutContainer::paintAnimatedElements(QPainter &painter, int yOffse
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
||||||
Selection &selection)
|
Selection &selection, int yOffset)
|
||||||
{
|
{
|
||||||
singletons::ThemeManager &themeManager = singletons::ThemeManager::getInstance();
|
singletons::ThemeManager &themeManager = singletons::ThemeManager::getInstance();
|
||||||
QColor selectionColor = themeManager.messages.selection;
|
QColor selectionColor = themeManager.messages.selection;
|
||||||
@@ -211,8 +211,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||||||
for (Line &line : this->lines) {
|
for (Line &line : this->lines) {
|
||||||
QRect rect = line.rect;
|
QRect rect = line.rect;
|
||||||
|
|
||||||
rect.setTop(std::max(0, rect.top()));
|
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||||
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
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];
|
Line &line = this->lines[lineIndex2];
|
||||||
QRect rect = line.rect;
|
QRect rect = line.rect;
|
||||||
|
|
||||||
rect.setTop(std::max(0, rect.top()));
|
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||||
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
||||||
|
|
||||||
@@ -290,8 +290,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||||||
|
|
||||||
QRect rect = line.rect;
|
QRect rect = line.rect;
|
||||||
|
|
||||||
rect.setTop(std::max(0, rect.top()));
|
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||||
rect.setLeft(x);
|
rect.setLeft(x);
|
||||||
rect.setRight(r);
|
rect.setRight(r);
|
||||||
|
|
||||||
@@ -316,8 +316,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||||||
if (line.endCharIndex < /*=*/selection.max.charIndex) {
|
if (line.endCharIndex < /*=*/selection.max.charIndex) {
|
||||||
QRect rect = line.rect;
|
QRect rect = line.rect;
|
||||||
|
|
||||||
rect.setTop(std::max(0, rect.top()));
|
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||||
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
rect.setRight(this->elements[line.endIndex - 1]->getRect().right());
|
||||||
|
|
||||||
@@ -340,8 +340,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
|||||||
|
|
||||||
QRect rect = line.rect;
|
QRect rect = line.rect;
|
||||||
|
|
||||||
rect.setTop(std::max(0, rect.top()));
|
rect.setTop(std::max(0, rect.top()) + yOffset);
|
||||||
rect.setBottom(std::min(this->height, rect.bottom()));
|
rect.setBottom(std::min(this->height, rect.bottom()) + yOffset);
|
||||||
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
rect.setLeft(this->elements[line.startIndex]->getRect().left());
|
||||||
rect.setRight(r);
|
rect.setRight(r);
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ struct MessageLayoutContainer {
|
|||||||
// painting
|
// painting
|
||||||
void paintElements(QPainter &painter);
|
void paintElements(QPainter &painter);
|
||||||
void paintAnimatedElements(QPainter &painter, int yOffset);
|
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
|
// selection
|
||||||
int getSelectionIndex(QPoint point);
|
int getSelectionIndex(QPoint point);
|
||||||
|
|||||||
Reference in New Issue
Block a user