Stop cursor from sticking to edges of scaled game window

This commit is contained in:
Dean Herbert 2019-01-16 17:21:26 +09:00
parent 89b5707f2b
commit 3abfaea7ac

View File

@ -28,6 +28,8 @@ namespace osu.Game.Graphics.Containers
private readonly Container content;
protected override Container<Drawable> Content => content;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
private readonly Container sizableContainer;
private Drawable backgroundLayer;
@ -41,7 +43,7 @@ namespace osu.Game.Graphics.Containers
this.targetMode = targetMode;
RelativeSizeAxes = Axes.Both;
InternalChild = sizableContainer = new Container
InternalChild = sizableContainer = new AlwaysInputContainer
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
@ -55,6 +57,8 @@ namespace osu.Game.Graphics.Containers
private readonly bool applyUIScale;
private Bindable<float> uiScale;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public ScalingDrawSizePreservingFillContainer(bool applyUIScale)
{
this.applyUIScale = applyUIScale;
@ -143,5 +147,15 @@ namespace osu.Game.Graphics.Containers
sizableContainer.MoveTo(targetPosition, 500, Easing.OutQuart);
sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; });
}
private class AlwaysInputContainer : Container
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public AlwaysInputContainer()
{
RelativeSizeAxes = Axes.Both;
}
}
}
}