Fix sliders to show entire range

Fix angle range on start and end angle sliders
This commit is contained in:
LarsBrubaker 2021-09-23 22:17:32 -07:00
parent b15ce7c5c5
commit 57f7c56685
5 changed files with 12 additions and 15 deletions

View file

@ -138,11 +138,11 @@ namespace MatterHackers.MatterControl.DesignTools
public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more cylinder options."; public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more cylinder options.";
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(0, 359, snapDistance: 1)]
public DoubleOrExpression StartingAngle { get; set; } = 0; public DoubleOrExpression StartingAngle { get; set; } = 0;
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(1, 360, snapDistance: 1)]
public DoubleOrExpression EndingAngle { get; set; } = 360; public DoubleOrExpression EndingAngle { get; set; } = 360;
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
@ -177,11 +177,6 @@ namespace MatterHackers.MatterControl.DesignTools
var startingAngle = StartingAngle.ClampIfNotCalculated(this, 0, 360 - .01, ref valuesChanged); var startingAngle = StartingAngle.ClampIfNotCalculated(this, 0, 360 - .01, ref valuesChanged);
var endingAngle = EndingAngle.ClampIfNotCalculated(this, StartingAngle.Value(this) + .01, 360, ref valuesChanged); var endingAngle = EndingAngle.ClampIfNotCalculated(this, StartingAngle.Value(this) + .01, 360, ref valuesChanged);
if (valuesChanged)
{
Invalidate(InvalidateType.DisplayValues);
}
using (RebuildLock()) using (RebuildLock())
{ {
using (new CenterAndHeightMaintainer(this, MaintainFlags.Origin | MaintainFlags.Bottom)) using (new CenterAndHeightMaintainer(this, MaintainFlags.Origin | MaintainFlags.Bottom))
@ -208,6 +203,8 @@ namespace MatterHackers.MatterControl.DesignTools
} }
} }
} }
Invalidate(InvalidateType.DisplayValues);
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh)); Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
return Task.CompletedTask; return Task.CompletedTask;

View file

@ -98,11 +98,11 @@ namespace MatterHackers.MatterControl.DesignTools
public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more ring options."; public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more ring options.";
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(0, 359, snapDistance: 1)]
public DoubleOrExpression StartingAngle { get; set; } = 0; public DoubleOrExpression StartingAngle { get; set; } = 0;
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(1, 360, snapDistance: 1)]
public DoubleOrExpression EndingAngle { get; set; } = 360; public DoubleOrExpression EndingAngle { get; set; } = 360;
[EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)] [EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)]

View file

@ -89,11 +89,11 @@ namespace MatterHackers.MatterControl.DesignTools
public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more sphere options."; public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more sphere options.";
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(0, 359, snapDistance: 1)]
public DoubleOrExpression StartingAngle { get; set; } = 0; public DoubleOrExpression StartingAngle { get; set; } = 0;
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(1, 360, snapDistance: 1)]
public DoubleOrExpression EndingAngle { get; set; } = 360; public DoubleOrExpression EndingAngle { get; set; } = 360;
[Slider(3, 180, Easing.EaseType.Quadratic, snapDistance: 1)] [Slider(3, 180, Easing.EaseType.Quadratic, snapDistance: 1)]

View file

@ -76,11 +76,11 @@ namespace MatterHackers.MatterControl.DesignTools
public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more torus options."; public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more torus options.";
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(0, 359, snapDistance: 1)]
public DoubleOrExpression StartingAngle { get; set; } = 0; public DoubleOrExpression StartingAngle { get; set; } = 0;
[MaxDecimalPlaces(2)] [MaxDecimalPlaces(2)]
[Slider(3, 360, snapDistance: 1)] [Slider(1, 360, snapDistance: 1)]
public DoubleOrExpression EndingAngle { get; set; } = 360; public DoubleOrExpression EndingAngle { get; set; } = 360;
[Slider(3, 260, Easing.EaseType.Quadratic, snapDistance: 1)] [Slider(3, 260, Easing.EaseType.Quadratic, snapDistance: 1)]

View file

@ -846,7 +846,7 @@ namespace MatterHackers.MatterControl.DesignTools
if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues)) if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues))
{ {
var newValue = (DoubleOrExpression)property.Value; var newValue = (DoubleOrExpression)property.Value;
if (newValue.Expression != field.Value) // if (newValue.Expression != field.Value)
{ {
// we should never be in the situation where there is an '=' as the in scene controls should be disabled // we should never be in the situation where there is an '=' as the in scene controls should be disabled
if (newValue.Expression.StartsWith("=")) if (newValue.Expression.StartsWith("="))
@ -921,7 +921,7 @@ namespace MatterHackers.MatterControl.DesignTools
if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues)) if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues))
{ {
var newValue = (IntOrExpression)property.Value; var newValue = (IntOrExpression)property.Value;
if (newValue.Expression != field.Value) // if (newValue.Expression != field.Value)
{ {
// we should never be in the situation where there is an '=' as the in scene controls should be disabled // we should never be in the situation where there is an '=' as the in scene controls should be disabled
if (newValue.Expression.StartsWith("=")) if (newValue.Expression.StartsWith("="))