aboutsummaryrefslogtreecommitdiff
path: root/rewindworkerthread.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-09 17:38:28 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-09 17:38:28 -0200
commit886bdd0fa43a2fcdeca306648b643b623af99f88 (patch)
tree7ffa1e622724862b8b99387199fb1ef7cbf79b28 /rewindworkerthread.cpp
parent962114b867c044240919ebc558c0b25f105db963 (diff)
Added TransitionControl and plot rewinding.
New component overlays main view and handles middle clicks/drags to performing rewinding. Also sports smooth transitioning back to current projection whenever the mouse button is lifted. Next up, the same kind of transitions in the displayed values.
Diffstat (limited to 'rewindworkerthread.cpp')
-rw-r--r--rewindworkerthread.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/rewindworkerthread.cpp b/rewindworkerthread.cpp
new file mode 100644
index 0000000..f9fa999
--- /dev/null
+++ b/rewindworkerthread.cpp
@@ -0,0 +1,23 @@
+#include "rewindworkerthread.h"
+
+// The full duration (usecs) of the restoration animation
+static const double DURATION = 250000;
+
+// The time to wait (usecs) before the next animation tick
+static const double TICK_TIME = DURATION / 60.0;
+
+// The amount to increase 't' per time step
+static const double TICK_SIZE = TICK_TIME / DURATION;
+
+void RewindWorkerThread::run()
+{
+ double t = m_control->t();
+
+ while (t + TICK_SIZE < 1.0) {
+ t += TICK_SIZE;
+ m_control->setT(t);
+ QThread::usleep(TICK_TIME);
+ }
+
+ m_control->setT(1.0);
+}