1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Fix inspect issues

This commit is contained in:
ekrctb 2022-10-05 22:04:43 +09:00
parent 00b3d97f69
commit 3108c42ece
2 changed files with 7 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;