mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
Fix inspect issues
This commit is contained in:
parent
00b3d97f69
commit
3108c42ece
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
@ -184,7 +183,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
double maxTime = dragBox.MaxTime;
|
||||
|
||||
SelectedItems.RemoveAll(hitObject => !shouldBeSelected(hitObject));
|
||||
SelectedItems.AddRange(Beatmap.HitObjects.Except(SelectedItems).Where(hitObject => shouldBeSelected(hitObject)));
|
||||
SelectedItems.AddRange(Beatmap.HitObjects.Except(SelectedItems).Where(shouldBeSelected));
|
||||
|
||||
bool shouldBeSelected(HitObject hitObject) => minTime <= hitObject.StartTime && hitObject.StartTime <= maxTime;
|
||||
}
|
||||
|
@ -8,20 +8,17 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Utils;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
{
|
||||
public class TimelineDragBox : DragBox
|
||||
{
|
||||
public double MinTime => Math.Min(startTime.Value, endTime);
|
||||
public double MinTime { get; private set; }
|
||||
|
||||
public double MaxTime => Math.Max(startTime.Value, endTime);
|
||||
public double MaxTime { get; private set; }
|
||||
|
||||
private double? startTime;
|
||||
|
||||
private double endTime;
|
||||
|
||||
[Resolved]
|
||||
private Timeline timeline { get; set; }
|
||||
|
||||
@ -34,7 +31,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
public override void HandleDrag(MouseButtonEvent e)
|
||||
{
|
||||
startTime ??= timeline.TimeAtPosition(e.MouseDownPosition.X);
|
||||
endTime = timeline.TimeAtPosition(e.MousePosition.X);
|
||||
double endTime = timeline.TimeAtPosition(e.MousePosition.X);
|
||||
|
||||
MinTime = Math.Min(startTime.Value, endTime);
|
||||
MaxTime = Math.Max(startTime.Value, endTime);
|
||||
|
||||
Box.X = timeline.PositionAtTime(MinTime);
|
||||
Box.Width = timeline.PositionAtTime(MaxTime) - Box.X;
|
||||
|
Loading…
Reference in New Issue
Block a user