commit 635d2164bb055c3c41a108c5477d4a506a65f05f
parent ca9e6c5aaf65b68ef81091a2716c30807a73e669
Author: William Casarin <jb55@jb55.com>
Date: Thu, 6 Nov 2025 19:07:08 -0800
ui: move debug slider to ui crate
might use this outside of notebook
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
3 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/crates/notedeck_notebook/src/debug.rs b/crates/notedeck_notebook/src/debug.rs
@@ -1,26 +0,0 @@
-
-/*
-fn debug_slider(
- ui: &mut egui::Ui,
- id: egui::Id,
- point: Pos2,
- initial: f32,
- range: std::ops::RangeInclusive<f32>,
-) -> f32 {
- let mut val = ui.data_mut(|d| *d.get_temp_mut_or::<f32>(id, initial));
- let nudge = vec2(10.0, 10.0);
- let slider = Rect::from_min_max(point - nudge, point + nudge);
- let label = Rect::from_min_max(point + nudge * 2.0, point - nudge * 2.0);
-
- let old_val = val;
- ui.put(slider, egui::Slider::new(&mut val, range));
- ui.put(label, egui::Label::new(format!("{val}")));
-
- if val != old_val {
- ui.data_mut(|d| d.insert_temp(id, val))
- }
-
- val
-}
-*/
-
diff --git a/crates/notedeck_ui/src/debug.rs b/crates/notedeck_ui/src/debug.rs
@@ -0,0 +1,24 @@
+use egui::{vec2, Pos2, Rect};
+
+pub fn debug_slider(
+ ui: &mut egui::Ui,
+ id: egui::Id,
+ point: Pos2,
+ initial: f32,
+ range: std::ops::RangeInclusive<f32>,
+) -> f32 {
+ let mut val = ui.data_mut(|d| *d.get_temp_mut_or::<f32>(id, initial));
+ let nudge = vec2(10.0, 10.0);
+ let slider = Rect::from_min_max(point - nudge, point + nudge);
+ let label = Rect::from_min_max(point + nudge * 2.0, point - nudge * 2.0);
+
+ let old_val = val;
+ ui.put(slider, egui::Slider::new(&mut val, range));
+ ui.put(label, egui::Label::new(format!("{val}")));
+
+ if val != old_val {
+ ui.data_mut(|d| d.insert_temp(id, val))
+ }
+
+ val
+}
diff --git a/crates/notedeck_ui/src/lib.rs b/crates/notedeck_ui/src/lib.rs
@@ -3,6 +3,7 @@ pub mod app_images;
pub mod colors;
pub mod constants;
pub mod context_menu;
+pub mod debug;
pub mod icons;
pub mod images;
pub mod media;
@@ -14,6 +15,7 @@ mod username;
pub mod widgets;
pub use anim::{AnimationHelper, PulseAlpha};
+pub use debug::debug_slider;
pub use icons::{expanding_button, ICON_EXPANSION_MULTIPLE, ICON_WIDTH};
pub use mention::Mention;
pub use note::{NoteContents, NoteOptions, NoteView};