mirror of
https://github.com/ppy/osu
synced 2024-12-17 04:15:37 +00:00
Update confine mode settings checkbox to match the new ConfineMouseTracker
logic
Not too happy with the duplicated logic, but settings can't depend on `ConfineMouseTracker` for testability reasons.
This commit is contained in:
parent
0fde9cd6ae
commit
a6bed04e50
@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
private Bindable<double> localSensitivity;
|
||||
|
||||
private Bindable<WindowMode> windowMode;
|
||||
private Bindable<bool> minimiseOnFocusLoss;
|
||||
private SettingsEnumDropdown<OsuConfineMouseMode> confineMouseModeSetting;
|
||||
private Bindable<bool> relativeMode;
|
||||
|
||||
@ -47,6 +48,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
|
||||
relativeMode = mouseHandler.UseRelativeMode.GetBoundCopy();
|
||||
windowMode = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
||||
minimiseOnFocusLoss = config.GetBindable<bool>(FrameworkSetting.MinimiseOnFocusLossInFullscreen);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -98,21 +100,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
|
||||
localSensitivity.BindValueChanged(val => handlerSensitivity.Value = val.NewValue);
|
||||
|
||||
windowMode.BindValueChanged(mode =>
|
||||
{
|
||||
bool isFullscreen = mode.NewValue == WindowMode.Fullscreen;
|
||||
|
||||
if (isFullscreen)
|
||||
{
|
||||
confineMouseModeSetting.Current.Disabled = true;
|
||||
confineMouseModeSetting.TooltipText = MouseSettingsStrings.NotApplicableFullscreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
confineMouseModeSetting.Current.Disabled = false;
|
||||
confineMouseModeSetting.TooltipText = string.Empty;
|
||||
}
|
||||
}, true);
|
||||
windowMode.BindValueChanged(_ => updateConfineMouseModeSettingVisibility());
|
||||
minimiseOnFocusLoss.BindValueChanged(_ => updateConfineMouseModeSettingVisibility(), true);
|
||||
|
||||
highPrecisionMouse.Current.BindValueChanged(highPrecision =>
|
||||
{
|
||||
@ -126,6 +115,25 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
}, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates disabled state and tooltip of <see cref="confineMouseModeSetting"/> to match when <see cref="ConfineMouseTracker"/> is overriding the confine mode.
|
||||
/// </summary>
|
||||
private void updateConfineMouseModeSettingVisibility()
|
||||
{
|
||||
bool confineModeOverriden = windowMode.Value == WindowMode.Fullscreen && minimiseOnFocusLoss.Value;
|
||||
|
||||
if (confineModeOverriden)
|
||||
{
|
||||
confineMouseModeSetting.Current.Disabled = true;
|
||||
confineMouseModeSetting.TooltipText = MouseSettingsStrings.NotApplicableFullscreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
confineMouseModeSetting.Current.Disabled = false;
|
||||
confineMouseModeSetting.TooltipText = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
|
||||
{
|
||||
public SensitivitySetting()
|
||||
|
Loading…
Reference in New Issue
Block a user