spectriclabs / sigplot

:chart_with_upwards_trend: SigPlot provides fast interactive web-plotting for software defined radio.
Apache License 2.0
8 stars 3 forks source link

timecode wrong when drawdirection == horizontal #6

Open rosspleban opened 3 years ago

rosspleban commented 3 years ago

The timecode message is wrong when using a 2D layer in the horizontal drawing mode. Possible fix below

diff --git a/js/sigplot.js b/js/sigplot.js
index 75fe004..1f7eda5 100644
--- a/js/sigplot.js
+++ b/js/sigplot.js
@@ -4486,7 +4486,14 @@
                 if ((hcb["class"] === 1) && ((hcb.xunits === 1) || (hcb.xunits === 4))) {
                     mx.message(Mx, "Time = " + m.sec2tod(hcb.timecode + Gx.retx), true);
                 } else if ((hcb["class"] === 2) && ((hcb.yunits === 1) || (hcb.yunits === 4))) {
-                    mx.message(Mx, "Time = " + m.sec2tod(hcb.timecode + Gx.rety), true);
+                    var drawdirection = Gx.lyr[0].drawdirection;
+                    var retval;
+                    if (drawdirection && drawdirection === "horizontal") {
+                        retval = Gx.retx;
+                    } else {
+                        retval = Gx.rety;
+                    }
+                    mx.message(Mx, "Time = " + m.sec2tod(hcb.timecode + retval), true);