1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Add feedback when area extends beyond tablet size

This commit is contained in:
Dean Herbert 2021-03-16 16:02:39 +09:00
parent 0a6525baee
commit 94f184d113

View File

@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Yellow,
Colour = Color4.White,
},
new OsuSpriteText
{
@ -78,21 +78,37 @@ namespace osu.Game.Overlays.Settings.Sections.Input
areaOffset.BindValueChanged(val =>
{
usableAreaContainer.MoveTo(new Vector2(val.NewValue.Width, val.NewValue.Height), 100, Easing.OutQuint);
checkBounds();
}, true);
areaSize.BindTo(handler.AreaSize);
areaSize.BindValueChanged(val =>
{
usableAreaContainer.ResizeTo(new Vector2(val.NewValue.Width, val.NewValue.Height), 100, Easing.OutQuint);
checkBounds();
}, true);
((IBindable<Size>)tabletSize).BindTo(handler.TabletSize);
tabletSize.BindValueChanged(val =>
{
tabletContainer.Size = new Vector2(val.NewValue.Width, val.NewValue.Height);
checkBounds();
});
}
[Resolved]
private OsuColour colour { get; set; }
private void checkBounds()
{
Size areaExtent = areaOffset.Value + areaSize.Value;
bool isWithinBounds = areaExtent.Width < tabletSize.Value.Width
&& areaExtent.Height < tabletSize.Value.Height;
usableAreaContainer.FadeColour(isWithinBounds ? colour.Blue : colour.RedLight, 100);
}
protected override void Update()
{
base.Update();