mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Improve field fade conditions.
This commit is contained in:
parent
c1f36d43d0
commit
fa8ed186d8
1 changed files with 15 additions and 5 deletions
|
@ -580,11 +580,21 @@ void InitMessageFieldFade(
|
|||
}, topFade->lifetime());
|
||||
|
||||
const auto descent = field->st().style.font->descent;
|
||||
topFade->show();
|
||||
bottomFade->showOn(field->scrollTop().value(
|
||||
) | rpl::map([field, descent](int scroll) {
|
||||
return (scroll + descent) < field->scrollTopMax();
|
||||
}) | rpl::distinct_until_changed());
|
||||
rpl::merge(
|
||||
field->changes(),
|
||||
field->scrollTop().changes() | rpl::to_empty,
|
||||
field->sizeValue() | rpl::to_empty
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto topHidden = !field->scrollTop().current();
|
||||
if (topFade->isHidden() != topHidden) {
|
||||
topFade->setVisible(!topHidden);
|
||||
}
|
||||
const auto adjusted = field->scrollTop().current() + descent;
|
||||
const auto bottomHidden = (adjusted >= field->scrollTopMax());
|
||||
if (bottomFade->isHidden() != bottomHidden) {
|
||||
bottomFade->setVisible(!bottomHidden);
|
||||
}
|
||||
}, topFade->lifetime());
|
||||
}
|
||||
|
||||
InlineBotQuery ParseInlineBotQuery(
|
||||
|
|
Loading…
Add table
Reference in a new issue