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

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