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)
|
, _history(history)
|
||||||
, _elementDelegate(_history->delegateMixin()->delegate())
|
, _elementDelegate(_history->delegateMixin()->delegate())
|
||||||
, _emojiInteractions(std::make_unique<HistoryView::EmojiInteractions>(
|
, _emojiInteractions(std::make_unique<HistoryView::EmojiInteractions>(
|
||||||
&controller->session()))
|
&controller->session(),
|
||||||
|
[=](not_null<const Element*> view) { return itemTop(view); }))
|
||||||
, _migrated(history->migrateFrom())
|
, _migrated(history->migrateFrom())
|
||||||
, _pathGradient(
|
, _pathGradient(
|
||||||
HistoryView::MakePathShiftGradient(
|
HistoryView::MakePathShiftGradient(
|
||||||
|
@ -375,7 +376,7 @@ HistoryInner::HistoryInner(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
_emojiInteractions->updateRequests(
|
_emojiInteractions->updateRequests(
|
||||||
) | rpl::start_with_next([=](QRect rect) {
|
) | rpl::start_with_next([=](QRect rect) {
|
||||||
update(rect.translated(0, _historyPaddingTop));
|
update(rect);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
_emojiInteractions->playStarted(
|
_emojiInteractions->playStarted(
|
||||||
) | rpl::start_with_next([=](QString &&emoji) {
|
) | rpl::start_with_next([=](QString &&emoji) {
|
||||||
|
@ -1173,8 +1174,6 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
||||||
p.setOpacity(1.);
|
p.setOpacity(1.);
|
||||||
|
|
||||||
_reactionsManager->paint(p, context);
|
_reactionsManager->paint(p, context);
|
||||||
|
|
||||||
p.translate(0, _historyPaddingTop);
|
|
||||||
_emojiInteractions->paint(p);
|
_emojiInteractions->paint(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2831,8 +2830,8 @@ void HistoryInner::visibleAreaUpdated(int top, int bottom) {
|
||||||
checkHistoryActivation();
|
checkHistoryActivation();
|
||||||
|
|
||||||
_emojiInteractions->visibleAreaUpdated(
|
_emojiInteractions->visibleAreaUpdated(
|
||||||
_visibleAreaTop - _historyPaddingTop,
|
_visibleAreaTop,
|
||||||
_visibleAreaBottom - _historyPaddingTop);
|
_visibleAreaBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryInner::displayScrollDate() const {
|
bool HistoryInner::displayScrollDate() const {
|
||||||
|
|
|
@ -44,8 +44,11 @@ constexpr auto kDropDelayedAfterDelay = crl::time(2000);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
EmojiInteractions::EmojiInteractions(not_null<Main::Session*> session)
|
EmojiInteractions::EmojiInteractions(
|
||||||
: _session(session) {
|
not_null<Main::Session*> session,
|
||||||
|
Fn<int(not_null<const Element*>)> itemTop)
|
||||||
|
: _session(session)
|
||||||
|
, _itemTop(std::move(itemTop)) {
|
||||||
_session->data().viewRemoved(
|
_session->data().viewRemoved(
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
return !_plays.empty() || !_delayed.empty();
|
return !_plays.empty() || !_delayed.empty();
|
||||||
|
@ -241,7 +244,10 @@ QRect EmojiInteractions::computeRect(
|
||||||
const auto left = rightAligned
|
const auto left = rightAligned
|
||||||
? (fullWidth - skip + shift - size.width())
|
? (fullWidth - skip + shift - size.width())
|
||||||
: (skip - shift);
|
: (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;
|
const auto top = viewTop + (sticker.height() - size.height()) / 2;
|
||||||
return QRect(QPoint(left, top), size);
|
return QRect(QPoint(left, top), size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,9 @@ class Element;
|
||||||
|
|
||||||
class EmojiInteractions final {
|
class EmojiInteractions final {
|
||||||
public:
|
public:
|
||||||
explicit EmojiInteractions(not_null<Main::Session*> session);
|
EmojiInteractions(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
Fn<int(not_null<const Element*>)> itemTop);
|
||||||
~EmojiInteractions();
|
~EmojiInteractions();
|
||||||
|
|
||||||
void play(
|
void play(
|
||||||
|
@ -90,6 +92,7 @@ private:
|
||||||
bool premium);
|
bool premium);
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
const Fn<int(not_null<const Element*>)> _itemTop;
|
||||||
|
|
||||||
int _visibleTop = 0;
|
int _visibleTop = 0;
|
||||||
int _visibleBottom = 0;
|
int _visibleBottom = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue