mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Paint effects in correct places.
This commit is contained in:
parent
ee793a2c59
commit
323cb78f22
3 changed files with 18 additions and 10 deletions
|
@ -321,7 +321,8 @@ HistoryInner::HistoryInner(
|
|||
, _history(history)
|
||||
, _elementDelegate(_history->delegateMixin()->delegate())
|
||||
, _emojiInteractions(std::make_unique<HistoryView::EmojiInteractions>(
|
||||
&controller->session()))
|
||||
&controller->session(),
|
||||
[=](not_null<const Element*> view) { return itemTop(view); }))
|
||||
, _migrated(history->migrateFrom())
|
||||
, _pathGradient(
|
||||
HistoryView::MakePathShiftGradient(
|
||||
|
@ -375,7 +376,7 @@ HistoryInner::HistoryInner(
|
|||
}, lifetime());
|
||||
_emojiInteractions->updateRequests(
|
||||
) | rpl::start_with_next([=](QRect rect) {
|
||||
update(rect.translated(0, _historyPaddingTop));
|
||||
update(rect);
|
||||
}, lifetime());
|
||||
_emojiInteractions->playStarted(
|
||||
) | rpl::start_with_next([=](QString &&emoji) {
|
||||
|
@ -1173,8 +1174,6 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
|||
p.setOpacity(1.);
|
||||
|
||||
_reactionsManager->paint(p, context);
|
||||
|
||||
p.translate(0, _historyPaddingTop);
|
||||
_emojiInteractions->paint(p);
|
||||
}
|
||||
|
||||
|
@ -2831,8 +2830,8 @@ void HistoryInner::visibleAreaUpdated(int top, int bottom) {
|
|||
checkHistoryActivation();
|
||||
|
||||
_emojiInteractions->visibleAreaUpdated(
|
||||
_visibleAreaTop - _historyPaddingTop,
|
||||
_visibleAreaBottom - _historyPaddingTop);
|
||||
_visibleAreaTop,
|
||||
_visibleAreaBottom);
|
||||
}
|
||||
|
||||
bool HistoryInner::displayScrollDate() const {
|
||||
|
|
|
@ -44,8 +44,11 @@ constexpr auto kDropDelayedAfterDelay = crl::time(2000);
|
|||
|
||||
} // namespace
|
||||
|
||||
EmojiInteractions::EmojiInteractions(not_null<Main::Session*> session)
|
||||
: _session(session) {
|
||||
EmojiInteractions::EmojiInteractions(
|
||||
not_null<Main::Session*> session,
|
||||
Fn<int(not_null<const Element*>)> itemTop)
|
||||
: _session(session)
|
||||
, _itemTop(std::move(itemTop)) {
|
||||
_session->data().viewRemoved(
|
||||
) | rpl::filter([=] {
|
||||
return !_plays.empty() || !_delayed.empty();
|
||||
|
@ -241,7 +244,10 @@ QRect EmojiInteractions::computeRect(
|
|||
const auto left = rightAligned
|
||||
? (fullWidth - skip + shift - size.width())
|
||||
: (skip - shift);
|
||||
const auto viewTop = view->block()->y() + view->y() + view->marginTop();
|
||||
const auto viewTop = _itemTop(view) + view->marginTop();
|
||||
if (viewTop < 0) {
|
||||
return QRect();
|
||||
}
|
||||
const auto top = viewTop + (sticker.height() - size.height()) / 2;
|
||||
return QRect(QPoint(left, top), size);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@ class Element;
|
|||
|
||||
class EmojiInteractions final {
|
||||
public:
|
||||
explicit EmojiInteractions(not_null<Main::Session*> session);
|
||||
EmojiInteractions(
|
||||
not_null<Main::Session*> session,
|
||||
Fn<int(not_null<const Element*>)> itemTop);
|
||||
~EmojiInteractions();
|
||||
|
||||
void play(
|
||||
|
@ -90,6 +92,7 @@ private:
|
|||
bool premium);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const Fn<int(not_null<const Element*>)> _itemTop;
|
||||
|
||||
int _visibleTop = 0;
|
||||
int _visibleBottom = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue