mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:28:00 +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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
var hitObject = b.HitObject;
|
||||
|
||||
var objectParent = (HitObjectContainer)hitObject.Parent;
|
||||
|
||||
// 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 += moveEvent.InstantDelta.Y;
|
||||
// StartTime could be used to adjust the position if only one movement event was received per frame.
|
||||
// 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 += 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
|
||||
// so we need to flip the vertical coordinate in the hitobject container's space
|
||||
// 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
|
||||
if (scrollingInfo.Direction.Value == ScrollingDirection.Down)
|
||||
targetPosition = -hitObject.Position.Y;
|
||||
else
|
||||
targetPosition = hitObject.Position.Y;
|
||||
targetPosition = -targetPosition;
|
||||
|
||||
objectParent.Remove(hitObject);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user