mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Merge pull request #6528 from smoogipoo/fix-mania-selection-movement
Fix mania hitobject selections not moving correctly
This commit is contained in:
commit
e3740fbc77
@ -65,24 +65,27 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
private void performDragMovement(MoveSelectionEvent moveEvent)
|
private void performDragMovement(MoveSelectionEvent moveEvent)
|
||||||
{
|
{
|
||||||
|
float delta = moveEvent.InstantDelta.Y;
|
||||||
|
|
||||||
|
// When scrolling downwards the anchor position is at the bottom of the screen, however the movement event assumes the anchor is at the top of the screen.
|
||||||
|
// This causes the delta to assume a positive hitobject position, and which can be corrected for by subtracting the parent height.
|
||||||
|
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
||||||
|
delta -= moveEvent.Blueprint.HitObject.Parent.DrawHeight;
|
||||||
|
|
||||||
foreach (var b in SelectedBlueprints)
|
foreach (var b in SelectedBlueprints)
|
||||||
{
|
{
|
||||||
var hitObject = b.HitObject;
|
var hitObject = b.HitObject;
|
||||||
|
|
||||||
var objectParent = (HitObjectContainer)hitObject.Parent;
|
var objectParent = (HitObjectContainer)hitObject.Parent;
|
||||||
|
|
||||||
// Using the hitobject position is required since AdjustPosition can be invoked multiple times per frame
|
// StartTime could be used to adjust the position if only one movement event was received per frame.
|
||||||
// without the position having been updated by the parenting ScrollingHitObjectContainer
|
// However this is not the case and ScrollingHitObjectContainer performs movement in UpdateAfterChildren() so the position must also be updated to be valid for further movement events
|
||||||
hitObject.Y += moveEvent.InstantDelta.Y;
|
hitObject.Y += delta;
|
||||||
|
|
||||||
float targetPosition;
|
float targetPosition = hitObject.Position.Y;
|
||||||
|
|
||||||
// If we're scrolling downwards, a position of 0 is actually further away from the hit target
|
// The scrolling algorithm always assumes an anchor at the top of the screen, so the position must be flipped when scrolling downwards to reflect a top anchor
|
||||||
// so we need to flip the vertical coordinate in the hitobject container's space
|
|
||||||
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
||||||
targetPosition = -hitObject.Position.Y;
|
targetPosition = -targetPosition;
|
||||||
else
|
|
||||||
targetPosition = hitObject.Position.Y;
|
|
||||||
|
|
||||||
objectParent.Remove(hitObject);
|
objectParent.Remove(hitObject);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user