mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed date badge in Shared GIFs section.
This commit is contained in:
parent
73bb1382b1
commit
9b6ab6e137
3 changed files with 24 additions and 16 deletions
|
@ -333,14 +333,9 @@ auto ListWidget::Section::findItemByPoint(
|
||||||
Expects(!_items.empty());
|
Expects(!_items.empty());
|
||||||
if (!_mosaic.empty()) {
|
if (!_mosaic.empty()) {
|
||||||
const auto found = _mosaic.findByPoint(point);
|
const auto found = _mosaic.findByPoint(point);
|
||||||
if (found.item) {
|
Assert(found.item != nullptr);
|
||||||
const auto rect = findItemRect(found.item);
|
const auto rect = findItemRect(found.item);
|
||||||
return { found.item, rect, rect.contains(point) };
|
return { found.item, rect, found.exact };
|
||||||
} else {
|
|
||||||
auto item = (_items.end() - 1)->second;
|
|
||||||
const auto rect = findItemRect(item);
|
|
||||||
return { item, rect, rect.contains(point) };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
auto itemIt = findItemAfterTop(point.y());
|
auto itemIt = findItemAfterTop(point.y());
|
||||||
if (itemIt == _items.end()) {
|
if (itemIt == _items.end()) {
|
||||||
|
|
|
@ -274,6 +274,7 @@ MosaicLayout::FoundItem MosaicLayout::findByPoint(
|
||||||
auto row = -1;
|
auto row = -1;
|
||||||
auto col = -1;
|
auto col = -1;
|
||||||
auto sel = -1;
|
auto sel = -1;
|
||||||
|
bool exact = true;
|
||||||
ClickHandlerPtr link;
|
ClickHandlerPtr link;
|
||||||
ItemBase *item = nullptr;
|
ItemBase *item = nullptr;
|
||||||
if (sy >= 0) {
|
if (sy >= 0) {
|
||||||
|
@ -285,6 +286,17 @@ MosaicLayout::FoundItem MosaicLayout::findByPoint(
|
||||||
}
|
}
|
||||||
sy -= rowHeight;
|
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()) {
|
if (sx >= 0 && row >= 0 && row < rowsCount()) {
|
||||||
const auto columnsCount = _rows[row].items.size();
|
const auto columnsCount = _rows[row].items.size();
|
||||||
|
@ -298,18 +310,18 @@ MosaicLayout::FoundItem MosaicLayout::findByPoint(
|
||||||
sx -= width;
|
sx -= width;
|
||||||
sx -= _rightSkip;
|
sx -= _rightSkip;
|
||||||
}
|
}
|
||||||
if (col < columnsCount) {
|
if (col >= columnsCount) {
|
||||||
item = itemAt(row, col);
|
col = columnsCount - 1;
|
||||||
sel = ::Layout::PositionToIndex(row, + col);
|
exact = false;
|
||||||
const auto result = item->getState(QPoint(sx, sy), {});
|
|
||||||
link = result.link;
|
|
||||||
} else {
|
|
||||||
row = col = -1;
|
|
||||||
}
|
}
|
||||||
|
item = itemAt(row, col);
|
||||||
|
sel = ::Layout::PositionToIndex(row, + col);
|
||||||
|
const auto result = item->getState(QPoint(sx, sy), {});
|
||||||
|
link = result.link;
|
||||||
} else {
|
} else {
|
||||||
row = col = -1;
|
row = col = -1;
|
||||||
}
|
}
|
||||||
return { link, item, sel };
|
return { link, item, sel, exact };
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Overview::Layout
|
} // namespace Overview::Layout
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
ClickHandlerPtr link;
|
ClickHandlerPtr link;
|
||||||
ItemBase *item = nullptr;
|
ItemBase *item = nullptr;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
bool exact = false;
|
||||||
};
|
};
|
||||||
MosaicLayout();
|
MosaicLayout();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue