LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-CROP-STRAIGHTEN: slider values say they can be typed
Nathaniel Ledford44741ecaeedc
diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.jsonindex 64a485ed2..b8aaff934 100644--- a/crates/ui-egui/locales/de.json+++ b/crates/ui-egui/locales/de.json@@ -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"}diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.jsonindex 461fa2f65..9f0362c32 100644--- a/crates/ui-egui/locales/es.json+++ b/crates/ui-egui/locales/es.json@@ -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"}diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.jsonindex 49f2ef807..1617546b4 100644--- a/crates/ui-egui/locales/ja.json+++ b/crates/ui-egui/locales/ja.json@@ -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": "クリックして値を入力"}diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.jsonindex 81e331c5c..f87b93699 100644--- a/crates/ui-egui/locales/pt-br.json+++ b/crates/ui-egui/locales/pt-br.json@@ -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"}diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.jsonindex 56ed57981..b7d5a0b64 100644--- a/crates/ui-egui/locales/ru.json+++ b/crates/ui-egui/locales/ru.json@@ -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": "Щёлкните, чтобы ввести значение"}diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.jsonindex 4074dfbda..ec8621b2d 100644--- a/crates/ui-egui/locales/zh-hans.json+++ b/crates/ui-egui/locales/zh-hans.json@@ -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": "点击以输入数值"}diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.jsonindex 96fcbb18b..901994155 100644--- a/crates/ui-egui/locales/zh-hant.json+++ b/crates/ui-egui/locales/zh-hant.json@@ -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": "按一下以輸入數值"}diff --git a/crates/ui-egui/src/tests_crop_rotate.rs b/crates/ui-egui/src/tests_crop_rotate.rsindex f5aca4e72..977cb4eb6 100644--- a/crates/ui-egui/src/tests_crop_rotate.rs+++ b/crates/ui-egui/src/tests_crop_rotate.rs@@ -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<_>>()+ );+}diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rsindex 8865995f9..9d41f1b70 100644--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@ -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