From fe17d04e571d180e663c7014e803ce790693f4b1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 20 Aug 2020 12:51:33 -0700 Subject: Display active values --- grapher/Models/Options/ActiveValueLabelXY.cs | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 grapher/Models/Options/ActiveValueLabelXY.cs (limited to 'grapher/Models/Options/ActiveValueLabelXY.cs') diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs new file mode 100644 index 0000000..b3b580f --- /dev/null +++ b/grapher/Models/Options/ActiveValueLabelXY.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Models.Options +{ + public class ActiveValueLabelXY + { + public const int ActiveLabelXYSeparation = 4; + + public ActiveValueLabelXY( + ActiveValueLabel x, + ActiveValueLabel y) + { + X = x; + Y = y; + Combined = false; + SetCombined(); + } + + public ActiveValueLabel X { get; } + + public ActiveValueLabel Y { get; } + + public bool Combined { get; private set; } + + public void SetValues(double x, double y) + { + X.SetValue(x); + Y.SetValue(y); + + if (x == y) + { + SetCombined(); + } + else + { + SetSeparate(); + } + } + + public void SetCombined() + { + if (!Combined) + { + Y.Hide(); + } + + Combined = true; + } + + public void SetSeparate() + { + if (Combined) + { + Y.Show(); + } + + Combined = false; + } + } +} -- cgit v1.2.3 From 7dbeae9d4cf108e78072b356d832123f12e42a90 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 20 Aug 2020 14:22:14 -0700 Subject: Add accel type to active values and tweak color --- grapher/Models/Options/ActiveValueLabelXY.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Options/ActiveValueLabelXY.cs') diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs index b3b580f..12506e9 100644 --- a/grapher/Models/Options/ActiveValueLabelXY.cs +++ b/grapher/Models/Options/ActiveValueLabelXY.cs @@ -8,7 +8,8 @@ namespace grapher.Models.Options { public class ActiveValueLabelXY { - public const int ActiveLabelXYSeparation = 4; + public const int ActiveLabelXYSeparation = 2; + public const string ShortenedFormatString = "0.###"; public ActiveValueLabelXY( ActiveValueLabel x, @@ -16,6 +17,14 @@ namespace grapher.Models.Options { X = x; Y = y; + + FullWidth = x.Width; + ShortenedWidth = (FullWidth - ActiveLabelXYSeparation) / 2; + + Y.Left = X.Left + ShortenedWidth + ActiveLabelXYSeparation; + Y.Width = ShortenedWidth; + Y.FormatString = ShortenedFormatString; + Combined = false; SetCombined(); } @@ -26,6 +35,10 @@ namespace grapher.Models.Options public bool Combined { get; private set; } + private int FullWidth { get; } + + private int ShortenedWidth { get; } + public void SetValues(double x, double y) { X.SetValue(x); @@ -45,6 +58,9 @@ namespace grapher.Models.Options { if (!Combined) { + X.FormatString = ActiveValueLabel.DefaultFormatString; + X.Width = FullWidth; + X.Prefix = string.Empty; Y.Hide(); } @@ -55,6 +71,10 @@ namespace grapher.Models.Options { if (Combined) { + X.FormatString = ShortenedFormatString; + X.Width = ShortenedWidth; + X.Prefix = "X"; + Y.Prefix = "Y"; Y.Show(); } -- cgit v1.2.3