1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 11:53:21 +08:00

Fix overlays closing when dragging from in/out or out/in

This commit is contained in:
Joehu 2019-12-01 12:02:47 -08:00
parent 4dc8e0ae20
commit 3b88afd069

View File

@ -67,33 +67,21 @@ namespace osu.Game.Graphics.Containers
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos);
protected override bool OnClick(ClickEvent e)
{
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
Hide();
private bool closeOnMouseUp;
return base.OnClick(e);
protected override bool OnMouseDown(MouseDownEvent e)
{
closeOnMouseUp = !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition) ? true : false;
return base.OnMouseDown(e);
}
private bool closeOnDragEnd;
protected override bool OnDragStart(DragStartEvent e)
protected override bool OnMouseUp(MouseUpEvent e)
{
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
closeOnDragEnd = true;
return base.OnDragStart(e);
}
protected override bool OnDragEnd(DragEndEvent e)
{
if (closeOnDragEnd)
{
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
Hide();
closeOnDragEnd = false;
}
return base.OnDragEnd(e);
return base.OnMouseUp(e);
}
public virtual bool OnPressed(GlobalAction action)