mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:17:27 +08:00
Fix position changing when origin updates during a drag
This commit is contained in:
parent
0b61e2cd42
commit
e7ca02ffde
@ -40,7 +40,9 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => drawableQuad.Contains(screenSpacePos);
|
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) =>
|
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) =>
|
||||||
drawableQuad.Contains(screenSpacePos);
|
drawableQuad.Contains(screenSpacePos);
|
||||||
|
@ -202,10 +202,10 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
var item = c.Item;
|
var item = c.Item;
|
||||||
Drawable drawable = (Drawable)item;
|
Drawable drawable = (Drawable)item;
|
||||||
|
|
||||||
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
|
|
||||||
|
|
||||||
if (!item.UsesFixedAnchor)
|
if (!item.UsesFixedAnchor)
|
||||||
ApplyClosestAnchorOrigin(drawable);
|
ApplyClosestAnchorOrigin(drawable);
|
||||||
|
|
||||||
|
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -332,7 +332,7 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
|
|
||||||
applyOrigin(drawable, origin);
|
applyOrigin(drawable, origin);
|
||||||
|
|
||||||
if (item.UsesFixedAnchor)
|
if (!item.UsesFixedAnchor)
|
||||||
ApplyClosestAnchorOrigin(drawable);
|
ApplyClosestAnchorOrigin(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user