summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-06-25 06:10:39 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-06-25 06:10:39 (GMT)
commit9803a0ca81d688fdd780b7fe78f7a2b592bb5e3d (patch)
treee93b6adb274eb06b73562e6195c709f8f8059b45 /src/declarative
parent4c0c1cbcdecec95c046a6862628621f005c2df56 (diff)
downloadQt-9803a0ca81d688fdd780b7fe78f7a2b592bb5e3d.zip
Qt-9803a0ca81d688fdd780b7fe78f7a2b592bb5e3d.tar.gz
Qt-9803a0ca81d688fdd780b7fe78f7a2b592bb5e3d.tar.bz2
No point running spring physics faster than our timer.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/util/qmlfollow.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp
index d1ecac4..cf3d629 100644
--- a/src/declarative/util/qmlfollow.cpp
+++ b/src/declarative/util/qmlfollow.cpp
@@ -93,11 +93,11 @@ void QmlFollowPrivate::tick(int time)
if (!elapsed)
return;
if (mode == Spring) {
- if (elapsed < 10) // capped at 100fps.
+ if (elapsed < 16) // capped at 62fps.
return;
// Real men solve the spring DEs using RK4.
// We'll do something much simpler which gives a result that looks fine.
- int count = (elapsed+5) / 10;
+ int count = (elapsed+8) / 16;
for (int i = 0; i < count; ++i) {
qreal diff = sourceValue - currentValue;
velocity = velocity + spring * diff - damping * velocity;
@@ -110,14 +110,14 @@ void QmlFollowPrivate::tick(int time)
else if (velocity < -maxVelocity)
velocity = -maxVelocity;
}
- currentValue += velocity * 10.0 / 1000.0;
+ currentValue += velocity * 16.0 / 1000.0;
}
if (qAbs(velocity) < epsilon && qAbs(sourceValue - currentValue) < epsilon) {
velocity = 0.0;
currentValue = sourceValue;
clock.stop();
}
- lastTime = time - (elapsed - count * 10);
+ lastTime = time - (elapsed - count * 16);
} else {
qreal moveBy = elapsed * velocityms;
qreal diff = sourceValue - currentValue;