Fixed date badge in Shared GIFs section.

This commit is contained in:
23rd 2021-07-23 06:53:50 +03:00 committed by John Preston
parent 73bb1382b1
commit 9b6ab6e137
3 changed files with 24 additions and 16 deletions

View File

@ -333,14 +333,9 @@ auto ListWidget::Section::findItemByPoint(
Expects(!_items.empty());
if (!_mosaic.empty()) {
const auto found = _mosaic.findByPoint(point);
if (found.item) {
const auto rect = findItemRect(found.item);
return { found.item, rect, rect.contains(point) };
} else {
auto item = (_items.end() - 1)->second;
const auto rect = findItemRect(item);
return { item, rect, rect.contains(point) };
}
Assert(found.item != nullptr);
const auto rect = findItemRect(found.item);
return { found.item, rect, found.exact };
}
auto itemIt = findItemAfterTop(point.y());
if (itemIt == _items.end()) {

View File

@ -274,6 +274,7 @@ MosaicLayout::FoundItem MosaicLayout::findByPoint(
auto row = -1;
auto col = -1;
auto sel = -1;
bool exact = true;
ClickHandlerPtr link;
ItemBase *item = nullptr;
if (sy >= 0) {
@ -285,6 +286,17 @@ MosaicLayout::FoundItem MosaicLayout::findByPoint(
}
sy -= rowHeight;
}
} else {
row = 0;
exact = false;
}
if (row >= rowsCount()) {
row = rowsCount() - 1;
exact = false;
}
if (sx < 0) {
sx = 0;
exact = false;
}
if (sx >= 0 && row >= 0 && row < rowsCount()) {
const auto columnsCount = _rows[row].items.size();
@ -298,18 +310,18 @@ MosaicLayout::FoundItem MosaicLayout::findByPoint(
sx -= width;
sx -= _rightSkip;
}
if (col < columnsCount) {
item = itemAt(row, col);
sel = ::Layout::PositionToIndex(row, + col);
const auto result = item->getState(QPoint(sx, sy), {});
link = result.link;
} else {
row = col = -1;
if (col >= columnsCount) {
col = columnsCount - 1;
exact = false;
}
item = itemAt(row, col);
sel = ::Layout::PositionToIndex(row, + col);
const auto result = item->getState(QPoint(sx, sy), {});
link = result.link;
} else {
row = col = -1;
}
return { link, item, sel };
return { link, item, sel, exact };
}
} // namespace Overview::Layout

View File

@ -17,6 +17,7 @@ public:
ClickHandlerPtr link;
ItemBase *item = nullptr;
int index = -1;
bool exact = false;
};
MosaicLayout();