mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Fix overlays closing when dragging from in/out or out/in
This commit is contained in:
parent
4dc8e0ae20
commit
3b88afd069
@ -67,33 +67,21 @@ namespace osu.Game.Graphics.Containers
|
|||||||
// receive input outside our bounds so we can trigger a close event on ourselves.
|
// receive input outside our bounds so we can trigger a close event on ourselves.
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos);
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos);
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
private bool closeOnMouseUp;
|
||||||
{
|
|
||||||
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
|
||||||
Hide();
|
|
||||||
|
|
||||||
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 OnMouseUp(MouseUpEvent e)
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e)
|
|
||||||
{
|
{
|
||||||
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||||
closeOnDragEnd = true;
|
|
||||||
|
|
||||||
return base.OnDragStart(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
|
||||||
{
|
|
||||||
if (closeOnDragEnd)
|
|
||||||
{
|
|
||||||
Hide();
|
Hide();
|
||||||
closeOnDragEnd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnDragEnd(e);
|
return base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool OnPressed(GlobalAction action)
|
public virtual bool OnPressed(GlobalAction action)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user