mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Hide tablet settings content when input handler is disabled
This commit is contained in:
@ -22,6 +22,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
private readonly ITabletHandler tabletHandler;
|
private readonly ITabletHandler tabletHandler;
|
||||||
|
|
||||||
|
private readonly Bindable<bool> enabled = new BindableBool(true);
|
||||||
|
|
||||||
private readonly Bindable<Vector2> areaOffset = new Bindable<Vector2>();
|
private readonly Bindable<Vector2> areaOffset = new Bindable<Vector2>();
|
||||||
private readonly Bindable<Vector2> areaSize = new Bindable<Vector2>();
|
private readonly Bindable<Vector2> areaSize = new Bindable<Vector2>();
|
||||||
private readonly IBindable<TabletInfo> tablet = new Bindable<TabletInfo>();
|
private readonly IBindable<TabletInfo> tablet = new Bindable<TabletInfo>();
|
||||||
@ -74,7 +76,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
LabelText = CommonStrings.Enabled,
|
LabelText = CommonStrings.Enabled,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Current = tabletHandler.Enabled
|
Current = enabled,
|
||||||
},
|
},
|
||||||
noTabletMessage = new FillFlowContainer
|
noTabletMessage = new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -194,6 +196,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
enabled.BindTo(tabletHandler.Enabled);
|
||||||
|
enabled.BindValueChanged(_ => Scheduler.AddOnce(updateVisibility));
|
||||||
|
|
||||||
rotation.BindTo(tabletHandler.Rotation);
|
rotation.BindTo(tabletHandler.Rotation);
|
||||||
|
|
||||||
areaOffset.BindTo(tabletHandler.AreaOffset);
|
areaOffset.BindTo(tabletHandler.AreaOffset);
|
||||||
@ -239,7 +244,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
tablet.BindTo(tabletHandler.Tablet);
|
tablet.BindTo(tabletHandler.Tablet);
|
||||||
tablet.BindValueChanged(val =>
|
tablet.BindValueChanged(val =>
|
||||||
{
|
{
|
||||||
Scheduler.AddOnce(toggleVisibility);
|
Scheduler.AddOnce(updateVisibility);
|
||||||
|
|
||||||
var tab = val.NewValue;
|
var tab = val.NewValue;
|
||||||
|
|
||||||
@ -259,8 +264,15 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleVisibility()
|
private void updateVisibility()
|
||||||
{
|
{
|
||||||
|
if (!tabletHandler.Enabled.Value)
|
||||||
|
{
|
||||||
|
mainSettings.Hide();
|
||||||
|
noTabletMessage.Hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool tabletFound = tablet.Value != null;
|
bool tabletFound = tablet.Value != null;
|
||||||
|
|
||||||
if (!tabletFound)
|
if (!tabletFound)
|
||||||
|
Reference in New Issue
Block a user