1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 11:03:05 +08:00

Merge branch 'master' into fix-slider-drag-marker-blocking-context-menu

This commit is contained in:
Dan Balasescu 2024-12-30 21:34:11 +09:00 committed by GitHub
commit 643e849029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
@ -131,7 +132,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private void updateSamplePointContractedState()
{
const double minimum_gap = 28;
const double absolute_minimum_gap = 31; // assumes single letter bank name for default banks
double minimumGap = absolute_minimum_gap;
if (timeline == null || editorClock == null)
return;
@ -153,9 +155,23 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
if (hitObject.GetEndTime() < editorClock.CurrentTime - timeline.VisibleRange / 2)
break;
foreach (var sample in hitObject.Samples)
{
if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
}
if (hitObject is IHasRepeats hasRepeats)
{
smallestTimeGap = Math.Min(smallestTimeGap, hasRepeats.Duration / hasRepeats.SpanCount() / 2);
foreach (var sample in hasRepeats.NodeSamples.SelectMany(s => s))
{
if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
}
}
double gap = lastTime - hitObject.GetEndTime();
// If the gap is less than 1ms, we can assume that the objects are stacked on top of each other
@ -167,7 +183,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
double smallestAbsoluteGap = ((TimelineSelectionBlueprintContainer)SelectionBlueprints).ContentRelativeToAbsoluteFactor.X * smallestTimeGap;
SamplePointContracted.Value = smallestAbsoluteGap < minimum_gap;
SamplePointContracted.Value = smallestAbsoluteGap < minimumGap;
}
private readonly Stack<HitObject> currentConcurrentObjects = new Stack<HitObject>();