Settings: allow custom UI scale percentages (#682)
Settings > Appearance > UI Scale offered only 75, 100, 125, 150, 175 and 200 %, so a size between 75 and 100 wasn't possible. It is now the shared numeric field (Kind::Int(75, 200, "%")): type or drag any whole percentage. The engine already stored the scale as a clamped integer and the UI applies it with set_zoom_factor, so the range, the default, live preview, Cancel and saved preferences are unchanged; the preset list goes. Numeric settings now apply a typed number once it is entered (Enter or leaving the field), not at every keystroke: typing 85 used to apply the partial 8, clamped to 75, and resize the whole interface before the 5. Dragging still applies as it moves. Tests: the UI Scale test types 85 a key at a time (nothing applies and the field keeps the keyboard until Enter), Cancel, 50 and 300 clamp to 75 and 200, 90 with OK, and a new app with the saved preferences starts at 90 %. The GPU Information transaction test types 125.
This commit is contained in:
@@ -47,11 +47,15 @@ fn check_info_transaction(via_escape: bool) {
|
||||
let edited_brightness = h.state().session.prefs.appearance.brightness;
|
||||
assert!((edited_brightness - original_brightness).abs() > 0.01, "real brightness slider changed");
|
||||
assert_eq!(saved(&store).prefs.appearance.brightness, original_brightness, "unconfirmed edit is not saved");
|
||||
// Use the upstream percent-valued Scale choice; keyboard zoom is deliberately disabled.
|
||||
// Type a UI Scale; keyboard zoom is deliberately disabled.
|
||||
let at = rect(&h, "settings.appearance.uiScale").center();
|
||||
click(&mut h, at);
|
||||
let at = h.get_by_label("125%").rect().center();
|
||||
click(&mut h, at);
|
||||
h.event(Event::Text("125".into()));
|
||||
for pressed in [true, false] {
|
||||
h.event(Event::Key { key: Key::Enter, physical_key: Some(Key::Enter), pressed, repeat: false, modifiers: Modifiers::NONE });
|
||||
h.step();
|
||||
}
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().session.prefs.appearance.ui_scale, 125);
|
||||
assert_eq!(saved(&store).prefs.appearance.ui_scale, 100, "unconfirmed scale edit is not saved");
|
||||
// Let UI Scale settle the centered dialog before reading its next hit target.
|
||||
|
||||
Reference in New Issue
Block a user