VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Fix #3370: each step stops at the bounds, so a step back in the same frame starts from there
Taha-Mahmoodicc499d7e8ebe
diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rsindex 86de5f204..d668e504a 100644--- a/crates/ui-egui/src/panels/stroke.rs+++ b/crates/ui-egui/src/panels/stroke.rs@@ -642,6 +642,11 @@ mod tests {let texts = frame(&mut app, vec![]);assert_eq!(stroke(&app)[which], low, "{shown}: {:?}", stroke(&app));assert!(texts.iter().any(|(t, _)| t == after), "{shown} → {after}: {texts:?}");+ // At the bound, a step down and a step up in one frame end one step above it.+ let key = |key| Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE };+ frame(&mut app, vec![key(egui::Key::ArrowDown), key(egui::Key::ArrowUp)]);+ let texts = frame(&mut app, vec![]);+ assert!(texts.iter().any(|(t, _)| t == shown), "{after}, down and up → {shown}: {texts:?}");}}}diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rsindex a89a84586..00452d98d 100644--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@ -390,6 +390,8 @@ fn step_value(let mut v = read(buf)?;for (mods, size, n) in steps {v = if mods == egui::Modifiers::SHIFT { v + size * n } else { step_to_multiple(v, size, n) };+ // Each step stops at the bounds, so a step back in the same frame starts from there.+ v = within(v, bounds);}// Rounded as fields show it, within the field's bounds.let v = within(round_to(v, STEP_DECIMALS), bounds);