1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 14:37:30 +08:00

Fix all repeat sliders being draggable

This commit is contained in:
OliBomby 2023-12-20 12:58:32 +01:00
parent 66f4dcc578
commit f7cb6b9ed0
3 changed files with 11 additions and 5 deletions

View File

@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
Color4 colour = colours.Yellow;
if (IsHovered && Slider.RepeatCount % 2 == 0)
if (IsHovered)
colour = colour.Lighten(1);
CirclePiece.Colour = colour;
@ -73,8 +73,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
protected override bool OnDragStart(DragStartEvent e)
{
// Disable dragging if the slider has an uneven number of repeats because the slider tail will be on the wrong side of the path.
if (e.Button == MouseButton.Right || !inputManager.CurrentState.Keyboard.ShiftPressed || Slider.RepeatCount % 2 == 1)
if (e.Button == MouseButton.Right || !inputManager.CurrentState.Keyboard.ShiftPressed)
return false;
isDragging = true;

View File

@ -32,7 +32,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
base.Update();
var circle = position == SliderPosition.Start ? (HitCircle)Slider.HeadCircle : Slider.TailCircle;
var circle = position == SliderPosition.Start ? (HitCircle)Slider.HeadCircle :
Slider.RepeatCount % 2 == 0 ? Slider.TailCircle : Slider.LastRepeat;
CirclePiece.UpdateFrom(circle);
marker.UpdateFrom(circle);

View File

@ -162,6 +162,9 @@ namespace osu.Game.Rulesets.Osu.Objects
[JsonIgnore]
public SliderTailCircle TailCircle { get; protected set; }
[JsonIgnore]
public SliderRepeat LastRepeat { get; protected set; }
public Slider()
{
SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples();
@ -225,7 +228,7 @@ namespace osu.Game.Rulesets.Osu.Objects
break;
case SliderEventType.Repeat:
AddNested(new SliderRepeat(this)
AddNested(LastRepeat = new SliderRepeat(this)
{
RepeatIndex = e.SpanIndex,
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
@ -248,6 +251,9 @@ namespace osu.Game.Rulesets.Osu.Objects
if (TailCircle != null)
TailCircle.Position = EndPosition;
if (LastRepeat != null)
LastRepeat.Position = RepeatCount % 2 == 0 ? Position : Position + Path.PositionAt(1);
}
protected void UpdateNestedSamples()