diff options
| author | Jacob Palecki <[email protected]> | 2020-09-25 23:03:00 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-25 23:03:00 -0700 |
| commit | 206cdc1712d02d15b85393a57ca744fbc014a55c (patch) | |
| tree | 5d28926aee87c077ffc4ed7222469bbf2f28bd2c | |
| parent | Last mouse move perfetly responsive at 100 FPS (diff) | |
| download | rawaccel-206cdc1712d02d15b85393a57ca744fbc014a55c.tar.xz rawaccel-206cdc1712d02d15b85393a57ca744fbc014a55c.zip | |
SetActive changes field default, bugs fixed
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 1 | ||||
| -rw-r--r-- | grapher/Models/Calculations/AccelCalculator.cs | 8 | ||||
| -rw-r--r-- | grapher/Models/Calculations/AccelChartData.cs | 12 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 12 | ||||
| -rw-r--r-- | grapher/Models/Fields/Field.cs | 10 | ||||
| -rw-r--r-- | grapher/Models/Options/Option.cs | 2 |
6 files changed, 25 insertions, 20 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 131df9c..cc86ff7 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -175,7 +175,6 @@ namespace grapher { AccelCharts.DrawLastMovement(); MouseWatcher.UpdateLastMove(); - AccelCharts.Redraw(); } #endregion Methods diff --git a/grapher/Models/Calculations/AccelCalculator.cs b/grapher/Models/Calculations/AccelCalculator.cs index 0838154..e2f7bcc 100644 --- a/grapher/Models/Calculations/AccelCalculator.cs +++ b/grapher/Models/Calculations/AccelCalculator.cs @@ -90,7 +90,7 @@ namespace grapher.Models.Calculations continue; } - while (Math.Pow(10,log) < outMagnitude) + while (Math.Pow(10,log) < outMagnitude && logIndex < data.LogToIndex.Length) { data.LogToIndex[logIndex] = index; log += 0.01; @@ -140,7 +140,7 @@ namespace grapher.Models.Calculations index--; - while (log <= 4.0) + while (log <= 5.0) { data.LogToIndex[logIndex] = index; log += 0.01; @@ -193,7 +193,7 @@ namespace grapher.Models.Calculations continue; } - while (Math.Pow(10,log) < magnitudeWithoutSens) + while (Math.Pow(10,log) < magnitudeWithoutSens && logIndex < data.Combined.LogToIndex.Length) { data.Combined.LogToIndex[logIndex] = index; log += 0.01; @@ -290,7 +290,7 @@ namespace grapher.Models.Calculations index--; - while (log <= 4.0) + while (log <= 5.0) { data.Combined.LogToIndex[logIndex] = index; log += 0.01; diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs index 98d501b..60d4c89 100644 --- a/grapher/Models/Calculations/AccelChartData.cs +++ b/grapher/Models/Calculations/AccelChartData.cs @@ -14,7 +14,7 @@ namespace grapher.Models.Calculations VelocityPoints = new SortedDictionary<double, double>(); GainPoints = new SortedDictionary<double, double>(); OutVelocityToPoints = new Dictionary<double, (double, double, double)>(); - LogToIndex = new int[601]; + LogToIndex = new int[701]; } #endregion Constructors @@ -85,15 +85,13 @@ namespace grapher.Models.Calculations { log = -2; } - else if (log > 4) + else if (log > 5) { - log = 4; - } - else - { - log = log * 100 + 200; + log = 5; } + log = log * 100 + 200; + var velIdx = LogToIndex[(int)log]; return velIdx; diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 3bd7601..d95c7ac 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -222,8 +222,8 @@ namespace grapher { if (min < max) { - ChartX.ChartAreas[0].AxisY.Minimum = min; - ChartX.ChartAreas[0].AxisY.Maximum = max; + ChartX.ChartAreas[0].AxisY.Minimum = min * 0.95; + ChartX.ChartAreas[0].AxisY.Maximum = max * 1.05; } } @@ -231,14 +231,14 @@ namespace grapher { if (minX < maxX) { - ChartX.ChartAreas[0].AxisY.Minimum = minX; - ChartX.ChartAreas[0].AxisY.Maximum = maxX; + ChartX.ChartAreas[0].AxisY.Minimum = minX * 0.95; + ChartX.ChartAreas[0].AxisY.Maximum = maxX * 1.05; } if (minY < maxY) { - ChartY.ChartAreas[0].AxisY.Minimum = minY; - ChartY.ChartAreas[0].AxisY.Maximum = maxY; + ChartY.ChartAreas[0].AxisY.Minimum = minY * 0.95; + ChartY.ChartAreas[0].AxisY.Maximum = maxY * 1.05; } } diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index df73dd7..541bbe2 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -52,7 +52,7 @@ namespace grapher public string FormatString { get; set; } - public string DefaultText { get; } + public string DefaultText { get; set; } public FieldState State { get; private set; } @@ -120,7 +120,7 @@ namespace grapher } } - private double DefaultData { get; } + private double DefaultData { get; set; } #endregion Properties @@ -138,6 +138,12 @@ namespace grapher Box.Enabled = true; } + public void SetNewDefault(double newDefault) + { + DefaultData = newDefault; + DefaultText = DecimalString(newDefault); + } + public void SetToDefault() { if (State != FieldState.Default) diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index c0d339e..d5129d5 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -136,6 +136,8 @@ namespace grapher public void SetActiveValue(double value) { ActiveValueLabel.SetValue(value); + Field.SetNewDefault(value); + Field.SetToDefault(); } public override void Hide() |