summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack-compat/options.cpp')
-rw-r--r--opentrack-compat/options.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/opentrack-compat/options.cpp b/opentrack-compat/options.cpp
index 4f8da9f7..1c222ba0 100644
--- a/opentrack-compat/options.cpp
+++ b/opentrack-compat/options.cpp
@@ -201,7 +201,21 @@ pbundle bundle(const QString& name)
return detail::singleton().bundle(name);
}
+slider_value::operator double() const
+{
+ return min + cur * (max-min);
+}
+slider_value slider_value::from_abs(double val, double min, double max)
+{
+ if (min > max)
+ min = max;
+ if (val < min)
+ val = min;
+ if (val > max)
+ val = max;
+ return slider_value((val - min) / (max - min), min, max);
+}
// end
}