Merge pull request #4069 from peppy/fix-sticking-cursor

Stop cursor from sticking to edges of scaled game window
This commit is contained in:
Dean Herbert 2019-01-17 12:56:14 +09:00 committed by GitHub
commit de5a9ed012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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