Merge pull request #12220 from peppy/editor-fix-speed-multiplier-precision

Fix legacy control point precision having an adverse effect on the editor
This commit is contained in:
Dan Balasescu 2021-03-31 18:00:11 +09:00 committed by GitHub
commit f6f1ef6986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -28,7 +28,16 @@ protected override void OnControlPointChanged(ValueChangedEvent<DifficultyContro
{ {
if (point.NewValue != null) if (point.NewValue != null)
{ {
multiplierSlider.Current = point.NewValue.SpeedMultiplierBindable; var selectedPointBindable = point.NewValue.SpeedMultiplierBindable;
// there may be legacy control points, which contain infinite precision for compatibility reasons (see LegacyDifficultyControlPoint).
// generally that level of precision could only be set by externally editing the .osu file, so at the point
// a user is looking to update this within the editor it should be safe to obliterate this additional precision.
double expectedPrecision = new DifficultyControlPoint().SpeedMultiplierBindable.Precision;
if (selectedPointBindable.Precision < expectedPrecision)
selectedPointBindable.Precision = expectedPrecision;
multiplierSlider.Current = selectedPointBindable;
multiplierSlider.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); multiplierSlider.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
} }
} }