mirror of https://github.com/procxx/kepka.git
Allow disabling new animations.
This commit is contained in:
parent
99bb09374d
commit
74dc4e0c62
|
@ -59,12 +59,11 @@ Manager::Manager() {
|
|||
}
|
||||
|
||||
void Manager::start(not_null<Basic*> animation) {
|
||||
_forceImmediateUpdate = true;
|
||||
if (_updating) {
|
||||
_starting.emplace_back(animation.get());
|
||||
} else {
|
||||
if (empty(_active)) {
|
||||
updateQueued();
|
||||
}
|
||||
schedule();
|
||||
_active.emplace_back(animation.get());
|
||||
}
|
||||
}
|
||||
|
@ -93,9 +92,11 @@ void Manager::update() {
|
|||
return;
|
||||
}
|
||||
const auto now = crl::now();
|
||||
if (_lastUpdateTime + kIgnoreUpdatesTimeout >= now) {
|
||||
if (!_forceImmediateUpdate
|
||||
&& (_lastUpdateTime + kIgnoreUpdatesTimeout >= now)) {
|
||||
return;
|
||||
}
|
||||
_forceImmediateUpdate = false;
|
||||
schedule();
|
||||
|
||||
_updating = true;
|
||||
|
@ -129,13 +130,17 @@ void Manager::schedule() {
|
|||
_scheduled = true;
|
||||
Ui::PostponeCall([=] {
|
||||
_scheduled = false;
|
||||
|
||||
const auto next = _lastUpdateTime + kAnimationTimeout;
|
||||
const auto now = crl::now();
|
||||
if (now < next) {
|
||||
_timerId = startTimer(next - now, Qt::PreciseTimer);
|
||||
} else {
|
||||
if (_forceImmediateUpdate) {
|
||||
_forceImmediateUpdate = false;
|
||||
updateQueued();
|
||||
} else {
|
||||
const auto next = _lastUpdateTime + kAnimationTimeout;
|
||||
const auto now = crl::now();
|
||||
if (now < next) {
|
||||
_timerId = startTimer(next - now, Qt::PreciseTimer);
|
||||
} else {
|
||||
updateQueued();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ private:
|
|||
int _timerId = 0;
|
||||
bool _updating = false;
|
||||
bool _scheduled = false;
|
||||
bool _forceImmediateUpdate = false;
|
||||
std::vector<ActiveBasicPointer> _active;
|
||||
std::vector<ActiveBasicPointer> _starting;
|
||||
rpl::lifetime _lifetime;
|
||||
|
@ -274,7 +275,9 @@ inline void Simple::start(
|
|||
that = _data.get(),
|
||||
callback = Prepare(std::forward<Callback>(callback))
|
||||
](crl::time now) {
|
||||
const auto time = (now - that->animation.started());
|
||||
const auto time = anim::Disabled()
|
||||
? that->duration
|
||||
: (now - that->animation.started());
|
||||
const auto finished = (time >= that->duration);
|
||||
const auto progress = finished
|
||||
? that->delta
|
||||
|
|
Loading…
Reference in New Issue