From 3abfaea7acef21fafb3d283e2a024432b05c2ce4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Jan 2019 17:21:26 +0900 Subject: [PATCH] Stop cursor from sticking to edges of scaled game window --- osu.Game/Graphics/Containers/ScalingContainer.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 8d21d6de10..62760b39ea 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -28,6 +28,8 @@ namespace osu.Game.Graphics.Containers private readonly Container content; protected override Container 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 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; + } + } } }