[chronojump] forcesensor analyze ab scale fixed at a, b extremes. fixes: https://gitlab.gnome.org/GNOME/chronojum
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] forcesensor analyze ab scale fixed at a, b extremes. fixes: https://gitlab.gnome.org/GNOME/chronojum
- Date: Tue, 11 Dec 2018 12:22:24 +0000 (UTC)
commit 79797f427d7238e64e1c185f970e03d3344f9429
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Dec 11 13:21:12 2018 +0100
forcesensor analyze ab scale fixed at a, b extremes. fixes:
https://gitlab.gnome.org/GNOME/chronojump/issues/68
src/gui/forceSensorAnalyze.cs | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index b9b6e993..62e63b39 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -938,8 +938,23 @@ public partial class ChronoJumpWindow
if(updateForceSensorHScales)
{
int difference = Convert.ToInt32(hscale_force_sensor_ai_ab.Value) -
force_sensor_last_ab;
- hscale_force_sensor_ai_a.Value += difference;
- hscale_force_sensor_ai_b.Value += difference;
+ int aValue = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+ int bValue = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+ //if a or b are at max, don't move the ab to the right
+ //if a or b are at min, don't move the ab to the left
+ if(
+ ( difference > 0 && aValue < fsAI.GetLength() -2 && bValue <
fsAI.GetLength() -2 ) ||
+ ( difference < 0 && aValue > 1 && bValue > 1 ) )
+ {
+ //move a and b
+ hscale_force_sensor_ai_a.Value += difference;
+ hscale_force_sensor_ai_b.Value += difference;
+ } else {
+ //do not move ab (so also a and b will not be moved)
+ updateForceSensorHScales = false;
+ hscale_force_sensor_ai_ab.Value = force_sensor_last_ab;
+ updateForceSensorHScales = true;
+ }
}
force_sensor_last_ab = Convert.ToInt32(hscale_force_sensor_ai_ab.Value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]