Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,25 @@ protected override void OnChildSizeChanged(Base child, Point oldChildSize, Point
SizeToChildren(resizeX: AutoSizeToContentWidthOnChildResize, resizeY: AutoSizeToContentHeightOnChildResize);
}

public void SetRange(double min, double max) => (Minimum, Maximum) = (min, max);
public void SetRange(double min, double max)
{
if (min > Maximum)
{
Maximum = max;
Minimum = min;
}
else if (max < Minimum)
{
Minimum = min;
Maximum = max;
}
else
{
// Safe to set in either order
Minimum = min;
Maximum = max;
}
}

public bool AutoSizeToContents
{
Expand Down
18 changes: 16 additions & 2 deletions Intersect.Client.Framework/Gwen/Control/Slider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,22 @@ protected virtual void SetValueInternal(double newInternalValue, bool forceUpdat
/// <param name="max">Maximum value.</param>
public void SetRange(double min, double max)
{
_minimumValue = min;
_maximumValue = max;
if (min > Maximum)
{
_maximumValue = max;
_minimumValue = min;
}
else if (max < Minimum)
{
_minimumValue = min;
_maximumValue = max;
}
else
{
// Safe to set in either order
_minimumValue = min;
_maximumValue = max;
}
}

/// <summary>
Expand Down
Loading