perf: smooth UI animations and reduce repaint overhead
Batch of performance and animation work: shared FadeHelper/MotionPrefs primitives, hover animators, shadow pixmap caching, smooth scrolling, seek time bubble, and widespread component repaint reductions.
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include <QScrollBar>
|
||||
#include <QSet>
|
||||
#include <QTimer>
|
||||
#include "../tokens/AnimationTokens.h"
|
||||
#include "../utils/motionprefs.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -249,12 +251,12 @@ void CollectionGrid::relayout(bool animate)
|
||||
}
|
||||
|
||||
QPoint target = posForIndex(i, m_columns);
|
||||
if (animate && card->pos() != target) {
|
||||
if (animate && !MotionPrefs::reduceMotion() && card->pos() != target) {
|
||||
stopPosAnimations(card);
|
||||
|
||||
auto* anim = new QPropertyAnimation(card, "pos", card);
|
||||
anim->setDuration(220);
|
||||
anim->setEasingCurve(QEasingCurve::OutCubic);
|
||||
anim->setDuration(AnimationTokens::DurationMs::kNormal);
|
||||
anim->setEasingCurve(AnimationTokens::Curve::enter());
|
||||
anim->setEndValue(target);
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
} else {
|
||||
@@ -319,11 +321,15 @@ void CollectionGrid::onCardDragEnd(CollectionCard* card)
|
||||
|
||||
stopPosAnimations(card);
|
||||
const QPoint target = posForIndex(finalIndex, m_columns);
|
||||
auto* anim = new QPropertyAnimation(card, "pos", card);
|
||||
anim->setDuration(180);
|
||||
anim->setEasingCurve(QEasingCurve::OutCubic);
|
||||
anim->setEndValue(target);
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
if (MotionPrefs::reduceMotion()) {
|
||||
card->move(target);
|
||||
} else {
|
||||
auto* anim = new QPropertyAnimation(card, "pos", card);
|
||||
anim->setDuration(AnimationTokens::DurationMs::kFast);
|
||||
anim->setEasingCurve(AnimationTokens::Curve::enter());
|
||||
anim->setEndValue(target);
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
if (changed && dragCard) {
|
||||
QStringList newOrderIds;
|
||||
|
||||
Reference in New Issue
Block a user