LR-CROP-STRAIGHTEN: slider values say they can be typed

Every slider's value already takes a typed number when clicked, which
is how to enter an exact crop angle (#534), but nothing said so.
Hovering a slider value now shows "Click to type a value", translated
in all seven locales. A headless test hovers the Straighten value and
finds the hint painted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nathaniel Ledford 2026-10-09 11:36:25 -04:00
parent 3ec6b72871
commit 44741ecaee
No known key found for this signature in database
9 changed files with 31 additions and 7 deletions

View File

@ -1887,5 +1887,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "Klicken, um einen Wert einzugeben"
}

View File

@ -1732,5 +1732,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "Hacer clic para escribir un valor"
}

View File

@ -1732,5 +1732,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "クリックして値を入力"
}

View File

@ -1732,5 +1732,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "Clique para digitar um valor"
}

View File

@ -1405,5 +1405,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "Щёлкните, чтобы ввести значение"
}

View File

@ -1732,5 +1732,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "点击以输入数值"
}

View File

@ -1732,5 +1732,6 @@
"Pending photo action cancelled": "Pending photo action cancelled",
"Pending photo action cancelled because its library or photo changed": "Pending photo action cancelled because its library or photo changed",
"ONNX model": "ONNX model",
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions"
"commercial use subject to GPL conditions": "commercial use subject to GPL conditions",
"Click to type a value": "按一下以輸入數值"
}

View File

@ -99,3 +99,18 @@ fn the_angle_reads_like_the_straighten_value() {
assert_eq!(crop_angle_label(-12.254), "-12.25°");
assert_eq!(crop_angle_label(-0.001), "0.00°", "no minus zero, and every zero the same");
}
/// Hovering the Straighten value says that a value can be typed there.
#[test]
fn the_straighten_value_says_it_can_be_typed() {
let mut h = crop_tool();
let r = h.request("ui.hoverWidget", json!({"id": "sliderValue:crop.angle"}), T);
assert_eq!(r["ok"], true, "{r}");
// tooltips wait for the pointer to rest
let _ = h.step_until(Duration::from_secs(5), |h| h.painted_text().iter().any(|t| t.contains("type")));
assert!(
h.painted_text().iter().any(|t| t == "Click to type a value"),
"{:?}",
h.painted_text().iter().filter(|t| t.contains("lick")).collect::<Vec<_>>()
);
}

View File

@ -180,6 +180,8 @@ pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_
let value_rect = Rect::from_min_max(pos2(label_rect.right() - 64.0, label_rect.top()), label_rect.max);
let value_resp = ui.interact(value_rect, id.with("value"), if enabled { Sense::click() } else { Sense::hover() });
register(ui.ctx(), format!("sliderValue:{}", spec.id), value_rect);
// say that an exact value can be typed here (issue #534: an exact crop angle was hard to find)
let value_resp = if enabled { value_resp.on_hover_text(crate::i18n::tr("Click to type a value")) } else { value_resp };
let typing_id = id.with("typing");
let field_id = id.with("typingField");
// the text being typed and how many frames the field has been up: it takes the keyboard on its