Skip to content

Commit

Permalink
actually fix sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
Fansana committed Dec 15, 2024
1 parent fcd2e83 commit cc8105b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1365,14 +1365,16 @@ private void UpdateHeightWidthSliders()
return;

var species = _species.Find(x => x.ID == Profile?.Species) ?? _species.First();

HeightSlider.MinValue = species.MinHeight;
HeightSlider.MaxValue = species.MaxHeight;
HeightSlider.SetValueWithoutEvent(Profile?.Height ?? species.DefaultHeight);
var width1 = Profile?.Width ?? species.DefaultHeight;
var height1 = Profile?.Height ?? species.DefaultHeight;

WidthSlider.MinValue = species.MinWidth;
WidthSlider.MaxValue = species.MaxWidth;
WidthSlider.SetValueWithoutEvent(Profile?.Width ?? species.DefaultWidth);
WidthSlider.SetValueWithoutEvent(width1);

HeightSlider.MinValue = species.MinHeight;
HeightSlider.MaxValue = species.MaxHeight;
HeightSlider.SetValueWithoutEvent(height1);

var height = MathF.Round(species.AverageHeight * HeightSlider.Value);
HeightLabel.Text = Loc.GetString("humanoid-profile-editor-height-label", ("height", (int) height));
Expand Down Expand Up @@ -1410,9 +1412,6 @@ private void UpdateDimensions(SliderUpdate updateType)
if (ratio < 1 / sizeRatio || ratio > sizeRatio)
heightValue = widthValue * (ratio < 1 / sizeRatio ? (1 / sizeRatio) : sizeRatio);

heightValue = Math.Clamp(heightValue, species.MinHeight, species.MaxHeight);
widthValue = Math.Clamp(widthValue, species.MinWidth, species.MaxWidth);

HeightSlider.Value = heightValue;
WidthSlider.Value = widthValue;

Expand Down

0 comments on commit cc8105b

Please sign in to comment.