mirror of
https://github.com/vladtrc/iw4L
synced 2026-10-27 18:52:15 -04:00
Allow fine controller sensitivity adjustments
The controller sensitivity slider advanced in steps of 0.5 and displayed only whole numbers, hiding the selected fractional value. Use 0.1 steps, matching the granularity of the earlier local controller slider while retaining master's 1-10 sensitivity scale and speed mapping. Add an optional decimal precision field to menu sliders and display one decimal for controller look sensitivity. Other sliders retain their default integer formatting; the renderer caps requested precision at six places. Validation: the play build, targeted formatting and diff checks passed. Temporary probes verified the controller menu's inherited slider definition, its 1-10 bounds and 0.1 step, decimal precision, and preservation of fractional sensitivity through settings sanitization. No permanent tests were added.
This commit is contained in:
@@ -99,6 +99,8 @@ pub struct MenuSlider {
|
||||
#[serde(default)]
|
||||
pub display_range: Option<[f32; 2]>,
|
||||
#[serde(default)]
|
||||
pub decimals: u8,
|
||||
#[serde(default)]
|
||||
pub suffix: String,
|
||||
}
|
||||
|
||||
|
||||
@@ -440,7 +440,8 @@ pub(crate) fn update_script_menus(
|
||||
let displayed = slider
|
||||
.display_range
|
||||
.map_or(value, |[min, max]| min + fraction * (max - min));
|
||||
label.text_key = format!("{displayed:.0}{}", slider.suffix);
|
||||
let decimals = usize::from(slider.decimals.min(6));
|
||||
label.text_key = format!("{displayed:.decimals$}{}", slider.suffix);
|
||||
label.rect.x += item.rect.w + 8.0;
|
||||
label.rect.w = 36.0;
|
||||
slider_parts.push(label);
|
||||
|
||||
@@ -307,9 +307,10 @@
|
||||
"slider": {
|
||||
"min": 1,
|
||||
"max": 10,
|
||||
"step": 0.5,
|
||||
"step": 0.1,
|
||||
"display_range": null,
|
||||
"suffix": ""
|
||||
"suffix": "",
|
||||
"decimals": 1
|
||||
},
|
||||
"name": "ui_pad_sensitivity"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user