From 628b6725b672fdb41a5ae2ae1cfbec295a1632ce Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 10 Apr 2018 17:01:30 -0700 Subject: [PATCH] Honor user scaling factor - Issue MatterHackers/MCCentral#3095 Toggle switch has fixed sizing, ignore user scaling values --- PartPreviewWindow/RoundedToggleSwitch.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PartPreviewWindow/RoundedToggleSwitch.cs b/PartPreviewWindow/RoundedToggleSwitch.cs index 09e4a1d5d..0ea5f9ef0 100644 --- a/PartPreviewWindow/RoundedToggleSwitch.cs +++ b/PartPreviewWindow/RoundedToggleSwitch.cs @@ -51,8 +51,10 @@ namespace MatterHackers.MatterControl.CustomWidgets private double right; private RoundedRect backgroundBar; - private double toggleRadius = 10; - private double toggleRadiusPlusPadding = 11; + private double minWidth = 45 * DeviceScale; + private double barHeight = 12.6 * DeviceScale; + private double toggleRadius = 9 * DeviceScale; + private double toggleRadiusPlusPadding = 10 * DeviceScale; private bool _checked; public bool Checked @@ -77,7 +79,7 @@ namespace MatterHackers.MatterControl.CustomWidgets inactiveBarColor = theme.Colors.IsDarkTheme ? theme.Shade : theme.SlightShade; activeBarColor = new Color(theme.Colors.PrimaryAccentColor, (theme.Colors.IsDarkTheme ? 100 : 70)); - this.MinimumSize = new Vector2(50, theme.ButtonHeight); + this.MinimumSize = new Vector2(minWidth, theme.ButtonHeight); } public override void OnMouseDown(MouseEventArgs mouseEvent) @@ -179,9 +181,7 @@ namespace MatterHackers.MatterControl.CustomWidgets { centerY = this.LocalBounds.YCenter; - var barHeight = 14; - - int halfBarHeight = barHeight / 2; + var halfBarHeight = barHeight / 2; var diff = toggleRadiusPlusPadding - halfBarHeight;