ui scale spinbox
This commit is contained in:
@@ -11,6 +11,7 @@ public class IdeSettings
|
||||
{
|
||||
public bool AutoOpenLastSolution { get; set; }
|
||||
public string? DebuggerExecutablePath { get; set; }
|
||||
public float UiScale { get; set; } = 1.0f;
|
||||
}
|
||||
|
||||
public record RecentSln
|
||||
|
||||
@@ -4,8 +4,20 @@ namespace SharpIDE.Godot.Features.Settings;
|
||||
|
||||
public partial class SettingsWindow : Window
|
||||
{
|
||||
private SpinBox _uiScaleSpinBox = null!;
|
||||
public override void _Ready()
|
||||
{
|
||||
CloseRequested += Hide;
|
||||
CloseRequested += Hide;
|
||||
_uiScaleSpinBox = GetNode<SpinBox>("%UiScaleSpinBox");
|
||||
//_uiScaleSlider.Value = Singletons.AppState.IdeSettings.UiScale;
|
||||
_uiScaleSpinBox.ValueChanged += OnUiScaleSpinBoxValueChanged;
|
||||
}
|
||||
|
||||
private void OnUiScaleSpinBoxValueChanged(double value)
|
||||
{
|
||||
var valueFloat = (float)value;
|
||||
Singletons.AppState.IdeSettings.UiScale = valueFloat;
|
||||
|
||||
GetTree().GetRoot().ContentScaleFactor = valueFloat;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ title = "Settings"
|
||||
initial_position = 2
|
||||
size = Vector2i(845, 400)
|
||||
transient = true
|
||||
transient_to_focused = true
|
||||
exclusive = true
|
||||
popup_window = true
|
||||
popup_wm_hint = true
|
||||
@@ -27,16 +28,8 @@ layout_mode = 2
|
||||
layout_mode = 2
|
||||
text = "UI Scale"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
min_value = 0.5
|
||||
max_value = 8.0
|
||||
step = 0.1
|
||||
value = 1.0
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
|
||||
[node name="UiScaleSpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
min_value = 0.5
|
||||
max_value = 8.0
|
||||
|
||||
Reference in New Issue
Block a user