1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-12 01:17:45 +08:00

Always select the closest control point group regardless of whether it has a timing point

This commit is contained in:
Bartłomiej Dach 2025-01-24 15:05:22 +01:00
parent 95a1b0e7cb
commit a0b6610054
No known key found for this signature in database
2 changed files with 15 additions and 15 deletions

View File

@ -20,6 +20,8 @@ namespace osu.Game.Screens.Edit.Timing
{ {
public partial class ControlPointList : CompositeDrawable public partial class ControlPointList : CompositeDrawable
{ {
public Action? SelectClosestTimingPoint { get; init; }
private ControlPointTable table = null!; private ControlPointTable table = null!;
private Container controls = null!; private Container controls = null!;
private OsuButton deleteButton = null!; private OsuButton deleteButton = null!;
@ -75,7 +77,7 @@ namespace osu.Game.Screens.Edit.Timing
new RoundedButton new RoundedButton
{ {
Text = "Select closest to current time", Text = "Select closest to current time",
Action = goToCurrentGroup, Action = SelectClosestTimingPoint,
Size = new Vector2(220, 30), Size = new Vector2(220, 30),
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -146,17 +148,6 @@ namespace osu.Game.Screens.Edit.Timing
table.Padding = new MarginPadding { Bottom = controls.DrawHeight }; table.Padding = new MarginPadding { Bottom = controls.DrawHeight };
} }
private void goToCurrentGroup()
{
double accurateTime = clock.CurrentTimeAccurate;
var activeTimingPoint = Beatmap.ControlPointInfo.TimingPointAt(accurateTime);
var activeEffectPoint = Beatmap.ControlPointInfo.EffectPointAt(accurateTime);
double latestActiveTime = Math.Max(activeTimingPoint.Time, activeEffectPoint.Time);
selectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(latestActiveTime);
}
private void delete() private void delete()
{ {
if (selectedGroup.Value == null) if (selectedGroup.Value == null)

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -37,7 +38,10 @@ namespace osu.Game.Screens.Edit.Timing
{ {
new Drawable[] new Drawable[]
{ {
new ControlPointList(), new ControlPointList
{
SelectClosestTimingPoint = selectClosestTimingPoint,
},
new ControlPointSettings(), new ControlPointSettings(),
}, },
} }
@ -70,8 +74,13 @@ namespace osu.Game.Screens.Edit.Timing
if (editorClock == null) if (editorClock == null)
return; return;
var nearestTimingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime); double accurateTime = editorClock.CurrentTimeAccurate;
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
var activeTimingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(accurateTime);
var activeEffectPoint = EditorBeatmap.ControlPointInfo.EffectPointAt(accurateTime);
double latestActiveTime = Math.Max(activeTimingPoint.Time, activeEffectPoint.Time);
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(latestActiveTime);
} }
protected override void ConfigureTimeline(TimelineArea timelineArea) protected override void ConfigureTimeline(TimelineArea timelineArea)