mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Move selection relative to the hitobject start positions
This commit is contained in:
@ -3,7 +3,6 @@
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||
@ -31,11 +30,14 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
editorClock = clock;
|
||||
}
|
||||
|
||||
public override void HandleDrag(SelectionBlueprint blueprint, DragEvent dragEvent)
|
||||
public override void HandleDrag(SelectionBlueprint blueprint, SelectionDragEvent dragEvent)
|
||||
{
|
||||
adjustOrigins((ManiaSelectionBlueprint)blueprint);
|
||||
var maniaBlueprint = (ManiaSelectionBlueprint)blueprint;
|
||||
int lastColumn = maniaBlueprint.HitObject.HitObject.Column;
|
||||
|
||||
adjustOrigins(maniaBlueprint);
|
||||
performDragMovement(dragEvent);
|
||||
performColumnMovement(dragEvent);
|
||||
performColumnMovement(lastColumn, dragEvent);
|
||||
|
||||
base.HandleDrag(blueprint, dragEvent);
|
||||
}
|
||||
@ -62,7 +64,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
b.HitObject.Y += movementDelta;
|
||||
}
|
||||
|
||||
private void performDragMovement(DragEvent dragEvent)
|
||||
private void performDragMovement(SelectionDragEvent dragEvent)
|
||||
{
|
||||
foreach (var b in SelectedBlueprints)
|
||||
{
|
||||
@ -72,7 +74,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
|
||||
// Using the hitobject position is required since AdjustPosition can be invoked multiple times per frame
|
||||
// without the position having been updated by the parenting ScrollingHitObjectContainer
|
||||
hitObject.Y += dragEvent.Delta.Y;
|
||||
hitObject.Y += dragEvent.InstantDragDelta.Y;
|
||||
|
||||
float targetPosition;
|
||||
|
||||
@ -94,14 +96,13 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
}
|
||||
}
|
||||
|
||||
private void performColumnMovement(DragEvent dragEvent)
|
||||
private void performColumnMovement(int lastColumn, SelectionDragEvent dragEvent)
|
||||
{
|
||||
var lastColumn = composer.ColumnAt(dragEvent.ScreenSpaceLastMousePosition);
|
||||
var currentColumn = composer.ColumnAt(dragEvent.ScreenSpaceMousePosition);
|
||||
if (lastColumn == null || currentColumn == null)
|
||||
var currentColumn = composer.ColumnAt(dragEvent.ScreenSpaceDragPosition);
|
||||
if (currentColumn == null)
|
||||
return;
|
||||
|
||||
int columnDelta = currentColumn.Index - lastColumn.Index;
|
||||
int columnDelta = currentColumn.Index - lastColumn;
|
||||
if (columnDelta == 0)
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user