mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Fix multiple issues with settings items unhiding on search
This commit is contained in:
parent
24deb5f5f4
commit
8f78d6179b
@ -177,13 +177,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
updateScreenModeWarning();
|
updateScreenModeWarning();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
windowModes.BindCollectionChanged((_, _) =>
|
windowModes.BindCollectionChanged((_, _) => updateDisplaySettingsVisibility());
|
||||||
{
|
|
||||||
if (windowModes.Count > 1)
|
|
||||||
windowModeDropdown.Show();
|
|
||||||
else
|
|
||||||
windowModeDropdown.Hide();
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
currentDisplay.BindValueChanged(display => Schedule(() =>
|
currentDisplay.BindValueChanged(display => Schedule(() =>
|
||||||
{
|
{
|
||||||
@ -219,7 +213,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
||||||
|
|
||||||
scalingSettings.AutoSizeAxes = scalingMode.Value != ScalingMode.Off ? Axes.Y : Axes.None;
|
scalingSettings.AutoSizeAxes = scalingMode.Value != ScalingMode.Off ? Axes.Y : Axes.None;
|
||||||
scalingSettings.ForEach(s => s.TransferValueOnCommit = scalingMode.Value == ScalingMode.Everything);
|
scalingSettings.ForEach(s =>
|
||||||
|
{
|
||||||
|
s.TransferValueOnCommit = scalingMode.Value == ScalingMode.Everything;
|
||||||
|
s.CanBeShown.Value = scalingMode.Value != ScalingMode.Off;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,20 +232,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
private void updateDisplaySettingsVisibility()
|
private void updateDisplaySettingsVisibility()
|
||||||
{
|
{
|
||||||
if (resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen)
|
windowModeDropdown.CanBeShown.Value = windowModes.Count > 1;
|
||||||
resolutionDropdown.Show();
|
resolutionDropdown.CanBeShown.Value = resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen;
|
||||||
else
|
displayDropdown.CanBeShown.Value = displayDropdown.Items.Count() > 1;
|
||||||
resolutionDropdown.Hide();
|
safeAreaConsiderationsCheckbox.CanBeShown.Value = host.Window?.SafeAreaPadding.Value.Total != Vector2.Zero;
|
||||||
|
|
||||||
if (displayDropdown.Items.Count() > 1)
|
|
||||||
displayDropdown.Show();
|
|
||||||
else
|
|
||||||
displayDropdown.Hide();
|
|
||||||
|
|
||||||
if (host.Window?.SafeAreaPadding.Value.Total != Vector2.Zero)
|
|
||||||
safeAreaConsiderationsCheckbox.Show();
|
|
||||||
else
|
|
||||||
safeAreaConsiderationsCheckbox.Hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateScreenModeWarning()
|
private void updateScreenModeWarning()
|
||||||
|
@ -143,6 +143,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
areaOffset.SetDefault();
|
areaOffset.SetDefault();
|
||||||
areaSize.SetDefault();
|
areaSize.SetDefault();
|
||||||
},
|
},
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsButton
|
new SettingsButton
|
||||||
{
|
{
|
||||||
@ -150,25 +151,29 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
forceAspectRatio((float)host.Window.ClientSize.Width / host.Window.ClientSize.Height);
|
forceAspectRatio((float)host.Window.ClientSize.Width / host.Window.ClientSize.Height);
|
||||||
}
|
},
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsSlider<float>
|
new SettingsSlider<float>
|
||||||
{
|
{
|
||||||
TransferValueOnCommit = true,
|
TransferValueOnCommit = true,
|
||||||
LabelText = TabletSettingsStrings.XOffset,
|
LabelText = TabletSettingsStrings.XOffset,
|
||||||
Current = offsetX
|
Current = offsetX,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsSlider<float>
|
new SettingsSlider<float>
|
||||||
{
|
{
|
||||||
TransferValueOnCommit = true,
|
TransferValueOnCommit = true,
|
||||||
LabelText = TabletSettingsStrings.YOffset,
|
LabelText = TabletSettingsStrings.YOffset,
|
||||||
Current = offsetY
|
Current = offsetY,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsSlider<float>
|
new SettingsSlider<float>
|
||||||
{
|
{
|
||||||
TransferValueOnCommit = true,
|
TransferValueOnCommit = true,
|
||||||
LabelText = TabletSettingsStrings.Rotation,
|
LabelText = TabletSettingsStrings.Rotation,
|
||||||
Current = rotation
|
Current = rotation,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new RotationPresetButtons(tabletHandler)
|
new RotationPresetButtons(tabletHandler)
|
||||||
{
|
{
|
||||||
@ -181,24 +186,28 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
TransferValueOnCommit = true,
|
TransferValueOnCommit = true,
|
||||||
LabelText = TabletSettingsStrings.AspectRatio,
|
LabelText = TabletSettingsStrings.AspectRatio,
|
||||||
Current = aspectRatio
|
Current = aspectRatio,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = TabletSettingsStrings.LockAspectRatio,
|
LabelText = TabletSettingsStrings.LockAspectRatio,
|
||||||
Current = aspectLock
|
Current = aspectLock,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsSlider<float>
|
new SettingsSlider<float>
|
||||||
{
|
{
|
||||||
TransferValueOnCommit = true,
|
TransferValueOnCommit = true,
|
||||||
LabelText = CommonStrings.Width,
|
LabelText = CommonStrings.Width,
|
||||||
Current = sizeX
|
Current = sizeX,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
new SettingsSlider<float>
|
new SettingsSlider<float>
|
||||||
{
|
{
|
||||||
TransferValueOnCommit = true,
|
TransferValueOnCommit = true,
|
||||||
LabelText = CommonStrings.Height,
|
LabelText = CommonStrings.Height,
|
||||||
Current = sizeY
|
Current = sizeY,
|
||||||
|
CanBeShown = { BindTarget = enabled }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3,14 +3,16 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
public partial class SettingsButton : RoundedButton, IHasTooltip
|
public partial class SettingsButton : RoundedButton, IHasTooltip, IConditionalFilterable
|
||||||
{
|
{
|
||||||
public SettingsButton()
|
public SettingsButton()
|
||||||
{
|
{
|
||||||
@ -20,6 +22,9 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
public LocalisableString TooltipText { get; set; }
|
public LocalisableString TooltipText { get; set; }
|
||||||
|
|
||||||
|
public BindableBool CanBeShown { get; } = new BindableBool(true);
|
||||||
|
IBindable<bool> IConditionalFilterable.CanBeShown => CanBeShown;
|
||||||
|
|
||||||
public override IEnumerable<LocalisableString> FilterTerms
|
public override IEnumerable<LocalisableString> FilterTerms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -22,7 +22,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
public abstract partial class SettingsItem<T> : Container, IFilterable, ISettingsItem, IHasCurrentValue<T>, IHasTooltip
|
public abstract partial class SettingsItem<T> : Container, IConditionalFilterable, ISettingsItem, IHasCurrentValue<T>, IHasTooltip
|
||||||
{
|
{
|
||||||
protected abstract Drawable CreateControl();
|
protected abstract Drawable CreateControl();
|
||||||
|
|
||||||
@ -144,6 +144,9 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
public bool FilteringActive { get; set; }
|
public bool FilteringActive { get; set; }
|
||||||
|
|
||||||
|
public BindableBool CanBeShown { get; } = new BindableBool(true);
|
||||||
|
IBindable<bool> IConditionalFilterable.CanBeShown => CanBeShown;
|
||||||
|
|
||||||
public event Action SettingChanged;
|
public event Action SettingChanged;
|
||||||
|
|
||||||
private T classicDefault;
|
private T classicDefault;
|
||||||
|
Loading…
Reference in New Issue
Block a user