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

Fix editor drag selection not continuing to select unless the mouse is moved

This commit is contained in:
Dean Herbert 2020-06-23 18:04:50 +09:00
parent 4e025d994c
commit 53d542546e

View File

@ -53,6 +53,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
};
private RectangleF? dragRectangle;
/// <summary>
/// Handle a forwarded mouse event.
/// </summary>
@ -66,15 +68,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
var dragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y);
// We use AABBFloat instead of RectangleF since it handles negative sizes for us
var dragRectangle = dragQuad.AABBFloat;
var rec = dragQuad.AABBFloat;
dragRectangle = rec;
var topLeft = ToLocalSpace(dragRectangle.TopLeft);
var bottomRight = ToLocalSpace(dragRectangle.BottomRight);
var topLeft = ToLocalSpace(rec.TopLeft);
var bottomRight = ToLocalSpace(rec.BottomRight);
Box.Position = topLeft;
Box.Size = bottomRight - topLeft;
PerformSelection?.Invoke(dragRectangle);
return true;
}
@ -93,7 +94,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
}
public override void Hide() => State = Visibility.Hidden;
protected override void Update()
{
base.Update();
if (dragRectangle != null)
PerformSelection?.Invoke(dragRectangle.Value);
}
public override void Hide()
{
State = Visibility.Hidden;
dragRectangle = null;
}
public override void Show() => State = Visibility.Visible;