2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Use new animations engine in all Basic-s.

This commit is contained in:
John Preston
2019-04-01 21:44:54 +04:00
parent cd3c1c6dc0
commit a6e96f9a28
41 changed files with 479 additions and 487 deletions

View File

@@ -400,7 +400,7 @@ BackgroundPreviewBox::BackgroundPreviewBox(
lang(lng_background_text2),
true))
, _paper(paper)
, _radial(animation(this, &BackgroundPreviewBox::step_radial)) {
, _radial([=](crl::time now) { return radialAnimationCallback(now); }) {
subscribe(Auth().downloaderTaskFinished(), [=] { update(); });
}
@@ -549,13 +549,8 @@ void BackgroundPreviewBox::paintImage(Painter &p, crl::time ms) {
}
void BackgroundPreviewBox::paintRadial(Painter &p, crl::time ms) {
bool radial = false;
float64 radialOpacity = 0;
if (_radial.animating()) {
_radial.step(ms);
radial = _radial.animating();
radialOpacity = _radial.opacity();
}
const auto radial = _radial.animating();
const auto radialOpacity = radial ? _radial.opacity() : 0.;
if (!radial) {
return;
}
@@ -623,7 +618,7 @@ void BackgroundPreviewBox::paintDate(Painter &p) {
p.drawText(bubbleLeft + st::msgServicePadding.left(), bubbleTop + st::msgServicePadding.top() + st::msgServiceFont->ascent, text);
}
void BackgroundPreviewBox::step_radial(crl::time ms, bool timer) {
void BackgroundPreviewBox::radialAnimationCallback(crl::time now) {
Expects(_paper.document() != nullptr);
const auto document = _paper.document();
@@ -631,9 +626,8 @@ void BackgroundPreviewBox::step_radial(crl::time ms, bool timer) {
const auto updated = _radial.update(
document->progress(),
!document->loading(),
ms);
if (timer
&& (wasAnimating || _radial.animating())
now);
if ((wasAnimating || _radial.animating())
&& (!anim::Disabled() || updated)) {
update(radialRect());
}