mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Use new animations engine in all Basic-s.
This commit is contained in:
@@ -58,7 +58,7 @@ private:
|
||||
QRect radialRect() const;
|
||||
void radialStart();
|
||||
crl::time radialTimeShift() const;
|
||||
void step_radial(crl::time ms, bool timer);
|
||||
void radialAnimationCallback(crl::time now);
|
||||
|
||||
QPixmap _background;
|
||||
object_ptr<Ui::LinkButton> _chooseFromGallery;
|
||||
@@ -114,7 +114,7 @@ BackgroundRow::BackgroundRow(QWidget *parent) : RpWidget(parent)
|
||||
lang(lng_settings_bg_from_gallery),
|
||||
st::settingsLink)
|
||||
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::settingsLink)
|
||||
, _radial(animation(this, &BackgroundRow::step_radial)) {
|
||||
, _radial([=](crl::time now) { radialAnimationCallback(now); }) {
|
||||
updateImage();
|
||||
|
||||
_chooseFromGallery->addClickHandler([] {
|
||||
@@ -139,13 +139,8 @@ BackgroundRow::BackgroundRow(QWidget *parent) : RpWidget(parent)
|
||||
void BackgroundRow::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
bool radial = false;
|
||||
float64 radialOpacity = 0;
|
||||
if (_radial.animating()) {
|
||||
_radial.step(crl::now());
|
||||
radial = _radial.animating();
|
||||
radialOpacity = _radial.opacity();
|
||||
}
|
||||
const auto radial = _radial.animating();
|
||||
const auto radialOpacity = radial ? _radial.opacity() : 0.;
|
||||
if (radial) {
|
||||
const auto backThumb = App::main()->newBackgroundThumb();
|
||||
if (!backThumb) {
|
||||
@@ -249,12 +244,12 @@ crl::time BackgroundRow::radialTimeShift() const {
|
||||
return st::radialDuration;
|
||||
}
|
||||
|
||||
void BackgroundRow::step_radial(crl::time ms, bool timer) {
|
||||
void BackgroundRow::radialAnimationCallback(crl::time now) {
|
||||
const auto updated = _radial.update(
|
||||
radialProgress(),
|
||||
!radialLoading(),
|
||||
ms + radialTimeShift());
|
||||
if (timer && _radial.animating() && (!anim::Disabled() || updated)) {
|
||||
now + radialTimeShift());
|
||||
if (!anim::Disabled() || updated) {
|
||||
rtlupdate(radialRect());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user