mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Refactor blueprint container drag code
This commit is contained in:
@ -170,11 +170,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
finishSelectionMovement();
|
||||
}
|
||||
|
||||
private MouseButtonEvent lastDragEvent;
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Right)
|
||||
return false;
|
||||
|
||||
lastDragEvent = e;
|
||||
|
||||
if (movementBlueprints != null)
|
||||
{
|
||||
isDraggingBlueprint = true;
|
||||
@ -189,22 +193,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Right)
|
||||
return;
|
||||
|
||||
if (DragBox.State == Visibility.Visible)
|
||||
{
|
||||
DragBox.HandleDrag(e);
|
||||
UpdateSelectionFromDragBox();
|
||||
}
|
||||
lastDragEvent = e;
|
||||
|
||||
moveCurrentSelection(e);
|
||||
}
|
||||
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Right)
|
||||
return;
|
||||
lastDragEvent = null;
|
||||
|
||||
if (isDraggingBlueprint)
|
||||
{
|
||||
@ -215,6 +211,18 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
DragBox.Hide();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (lastDragEvent != null && DragBox.State == Visibility.Visible)
|
||||
{
|
||||
lastDragEvent.Target = this;
|
||||
DragBox.HandleDrag(lastDragEvent);
|
||||
UpdateSelectionFromDragBox();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called whenever a drag operation completes, before any change transaction is committed.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user