1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Merge pull request #20141 from peppy/fix-editor-timeline-sv-display

Fix incorrect slider length in timeline when non-default velocity is inherited from previous object
This commit is contained in:
Dan Balasescu 2022-09-05 17:51:25 +09:00 committed by GitHub
commit 87e26e34b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 31 deletions

View File

@ -89,6 +89,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
HitObject.DifficultyControlPoint = nearestDifficultyPoint ?? new DifficultyControlPoint();
HitObject.Position = ToLocalSpace(result.ScreenSpacePosition);
// Replacing the DifficultyControlPoint above doesn't trigger any kind of invalidation.
// Without re-applying defaults, velocity won't be updated.
ApplyDefaultsToHitObject();
break;
case SliderPlacementState.Body:

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -33,19 +31,19 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
private const float circle_size = 38;
private Container repeatsContainer;
private Container? repeatsContainer;
public Action<DragEvent> OnDragHandled;
public Action<DragEvent?>? OnDragHandled = null!;
[UsedImplicitly]
private readonly Bindable<double> startTime;
private Bindable<int> indexInCurrentComboBindable;
private Bindable<int>? indexInCurrentComboBindable;
private Bindable<int> comboIndexBindable;
private Bindable<int> comboIndexWithOffsetsBindable;
private Bindable<int>? comboIndexBindable;
private Bindable<int>? comboIndexWithOffsetsBindable;
private Bindable<Color4> displayColourBindable;
private Bindable<Color4> displayColourBindable = null!;
private readonly ExtendableCircle circle;
private readonly Border border;
@ -54,7 +52,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly OsuSpriteText comboIndexText;
[Resolved]
private ISkinSource skin { get; set; }
private ISkinSource skin { get; set; } = null!;
public TimelineHitObjectBlueprint(HitObject item)
: base(item)
@ -124,7 +122,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
case IHasComboInformation comboInfo:
indexInCurrentComboBindable = comboInfo.IndexInCurrentComboBindable.GetBoundCopy();
indexInCurrentComboBindable.BindValueChanged(_ => updateComboIndex(), true);
indexInCurrentComboBindable.BindValueChanged(_ =>
{
comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
}, true);
comboIndexBindable = comboInfo.ComboIndexBindable.GetBoundCopy();
comboIndexWithOffsetsBindable = comboInfo.ComboIndexWithOffsetsBindable.GetBoundCopy();
@ -149,8 +150,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
updateColour();
}
private void updateComboIndex() => comboIndexText.Text = (indexInCurrentComboBindable.Value + 1).ToString();
private void updateColour()
{
Color4 colour;
@ -183,11 +182,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
colouredComponents.Colour = OsuColour.ForegroundTextColourFor(averageColour);
}
private SamplePointPiece sampleOverrideDisplay;
private DifficultyPointPiece difficultyOverrideDisplay;
private SamplePointPiece? sampleOverrideDisplay;
private DifficultyPointPiece? difficultyOverrideDisplay;
private DifficultyControlPoint difficultyControlPoint;
private SampleControlPoint sampleControlPoint;
private DifficultyControlPoint difficultyControlPoint = null!;
private SampleControlPoint sampleControlPoint = null!;
protected override void Update()
{
@ -276,16 +275,27 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public class DragArea : Circle
{
private readonly HitObject hitObject;
private readonly HitObject? hitObject;
[Resolved]
private Timeline timeline { get; set; }
private EditorBeatmap beatmap { get; set; } = null!;
public Action<DragEvent> OnDragHandled;
[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; } = null!;
[Resolved]
private Timeline timeline { get; set; } = null!;
[Resolved(CanBeNull = true)]
private IEditorChangeHandler? changeHandler { get; set; }
private ScheduledDelegate? dragOperation;
public Action<DragEvent?>? OnDragHandled;
public override bool HandlePositionalInput => hitObject != null;
public DragArea(HitObject hitObject)
public DragArea(HitObject? hitObject)
{
this.hitObject = hitObject;
@ -356,23 +366,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
this.FadeTo(IsHovered || hasMouseDown ? 1f : 0.9f, 200, Easing.OutQuint);
}
[Resolved]
private EditorBeatmap beatmap { get; set; }
[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; }
[Resolved(CanBeNull = true)]
private IEditorChangeHandler changeHandler { get; set; }
protected override bool OnDragStart(DragStartEvent e)
{
changeHandler?.BeginChange();
return true;
}
private ScheduledDelegate dragOperation;
protected override void OnDrag(DragEvent e)
{
base.OnDrag(e);