[chronojump] ForceSensor analyze graph fixed triggers x



commit 2cb43817a7b1dfc1ae2960b17cecc3696786a0c1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 28 12:00:35 2021 +0200

    ForceSensor analyze graph fixed triggers x

 src/gui/app1/forceSensorAnalyze.cs | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/gui/app1/forceSensorAnalyze.cs b/src/gui/app1/forceSensorAnalyze.cs
index 4749bf65..c5dd90df 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -1611,24 +1611,30 @@ public partial class ChronoJumpWindow
                // triggers. Right now only show triggers on not zoom
                if(! forceSensorZoomApplied)
                {
+                       int firstCount = 0;
+                       double firstMs = fsAI.GetTimeMS(firstCount);
+                       int xFirstPos = fsAI.GetXFromSampleCount(firstCount);
+                       //LogB.Information(string.Format("no zoom: firstCount: {0}, firstMs: {1}, xFirstPos: 
{2}", firstCount, firstMs, xFirstPos));
+
                        int lastCount = fsAI.GetLength() -1;
                        double lastMs = fsAI.GetTimeMS(lastCount);
                        int xLastPos = fsAI.GetXFromSampleCount(lastCount);
+                       //LogB.Information(string.Format("no zoom: lastCount: {0}, lastMs: {1}, xLastPos: 
{2}", lastCount, lastMs, xLastPos));
 
                        foreach(Trigger trigger in triggerListForceSensor.GetList())
                        {
                                //write the vertical start line
                                //int tempX = fsAI.GetXFromSampleCount(trigger.Ms); not because is not a count
 
-                               double triggerPercent1 = UtilAll.DivideSafe(trigger.Ms, lastMs);
-                               int xtrigger = Convert.ToInt32(triggerPercent1 * xLastPos);
+                               double triggerPercent1 = UtilAll.DivideSafe(trigger.Ms, (lastMs-firstMs));
+                               int xtrigger = Convert.ToInt32(triggerPercent1 * (xLastPos - xFirstPos)) + 
xFirstPos;
 
-                               if(trigger.InOut)
-                                       force_sensor_ai_pixmap.DrawLine(pen_green_force_ai,
-                                                       xtrigger, textHeight +6, xtrigger, allocation.Height 
- textHeight -6);
-                               else
-                                       force_sensor_ai_pixmap.DrawLine(pen_red_force_ai,
-                                                       xtrigger, textHeight +6, xtrigger, allocation.Height 
- textHeight -6);
+                               Gdk.GC myPen = pen_green_force_ai; //in
+                               if(! trigger.InOut)
+                                       myPen = pen_red_force_ai; //out
+
+                               force_sensor_ai_pixmap.DrawLine(myPen,
+                                               xtrigger, textHeight +6, xtrigger, allocation.Height - 
textHeight -6);
                        }
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]