1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Fix position changing when origin updates during a drag

This commit is contained in:
Dean Herbert 2024-05-04 13:28:33 +08:00
parent 0b61e2cd42
commit e7ca02ffde
No known key found for this signature in database
2 changed files with 6 additions and 4 deletions

View File

@ -40,7 +40,9 @@ namespace osu.Game.Overlays.SkinEditor
public override bool Contains(Vector2 screenSpacePos) => drawableQuad.Contains(screenSpacePos);
public override Vector2 ScreenSpaceSelectionPoint => drawable.ToScreenSpace(drawable.OriginPosition);
public override Vector2 ScreenSpaceSelectionPoint =>
// Important to use a stable position (not based on origin) as origin may be automatically updated during drag operations.
drawable.ScreenSpaceDrawQuad.Centre;
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) =>
drawableQuad.Contains(screenSpacePos);

View File

@ -202,10 +202,10 @@ namespace osu.Game.Overlays.SkinEditor
var item = c.Item;
Drawable drawable = (Drawable)item;
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
if (!item.UsesFixedAnchor)
ApplyClosestAnchorOrigin(drawable);
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
}
return true;
@ -332,7 +332,7 @@ namespace osu.Game.Overlays.SkinEditor
applyOrigin(drawable, origin);
if (item.UsesFixedAnchor)
if (!item.UsesFixedAnchor)
ApplyClosestAnchorOrigin(drawable);
}