summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-04-06 00:42:58 -0700
committerJacob Palecki <[email protected]>2021-04-06 00:42:58 -0700
commit399aaf96f863029206fc672a1dc4b556ed456c58 (patch)
tree5decdb1fb713c263685945714cf64bc609576cd6
parentResize vertically for correctness (diff)
downloadrawaccel-399aaf96f863029206fc672a1dc4b556ed456c58.tar.xz
rawaccel-399aaf96f863029206fc672a1dc4b556ed456c58.zip
Fix checkbox not snapping
-rw-r--r--grapher/Models/Options/AccelTypeOptions.cs2
-rw-r--r--grapher/Models/Options/CheckBoxOption.cs14
2 files changed, 14 insertions, 2 deletions
diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs
index ded9ac5..851c44d 100644
--- a/grapher/Models/Options/AccelTypeOptions.cs
+++ b/grapher/Models/Options/AccelTypeOptions.cs
@@ -308,7 +308,7 @@ namespace grapher
{
if (top < 0)
{
- top = Acceleration.Top;
+ top = GainSwitch.Top;
}
AccelerationType.Layout(
diff --git a/grapher/Models/Options/CheckBoxOption.cs b/grapher/Models/Options/CheckBoxOption.cs
index 43757b4..83b2d7a 100644
--- a/grapher/Models/Options/CheckBoxOption.cs
+++ b/grapher/Models/Options/CheckBoxOption.cs
@@ -7,6 +7,7 @@ namespace grapher.Models.Options
public CheckBoxOption(CheckBox checkBox)
{
CheckBox = checkBox;
+ Show(string.Empty);
}
public CheckBox CheckBox { get; }
@@ -15,7 +16,7 @@ namespace grapher.Models.Options
{
get
{
- return CheckBox.Visible;
+ return CheckBox.Visible || ShouldShow;
}
}
@@ -63,6 +64,13 @@ namespace grapher.Models.Options
}
}
+ /// <summary>
+ /// For some reason, setting CheckBox.Show() does not result in visible not being true on GUI startup.
+ /// This is inconsistent with the other options, which do.
+ /// Keep this bool for allowing Visible to still be the signal for option snapping.
+ /// </summary>
+ private bool ShouldShow { get; set; }
+
public override void AlignActiveValues()
{
}
@@ -70,11 +78,15 @@ namespace grapher.Models.Options
public override void Hide()
{
CheckBox.Hide();
+ ShouldShow = false;
+ CheckBox.Enabled = false;
}
public override void Show(string Name)
{
CheckBox.Show();
+ ShouldShow = true;
+ CheckBox.Enabled = true;
CheckBox.Name = Name;
}
}