Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge #143: One searchable font menu for every font field; hidden .Name fonts left out; Contextual Task Bar draggable, with Pin and Reset

aiongg97edaf461adc
diff --cc crates/ui-egui/src/lib.rs
index 8ad606305,7e3870f98..a6c4fa9e8
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@@ -1046,20 -927,11 +1055,28 @@@ pub(crate) mod test_window
h
}
+ /// The mouse wheel turned over `pos`: positive `delta` moves the content right and down.
+ pub fn wheel(h: &mut Harness<'static, Window>, pos: egui::Pos2, delta: egui::Vec2) {
+ h.hover_at(pos);
+ h.event(egui::Event::MouseWheel {
+ unit: egui::MouseWheelUnit::Point,
+ delta,
+ phase: egui::TouchPhase::Move,
+ modifiers: egui::Modifiers::NONE,
+ });
+ h.run_steps(10);
+ }
+
+ /// The outer rect of a side or top panel, from egui's memory.
+ pub fn panel_rect(h: &Harness<'static, Window>, id: &str) -> egui::Rect {
+ egui::containers::panel::PanelState::load(&h.ctx, egui::Id::new(id)).map(|s| s.outer_rect).unwrap()
+ }
++
+ /// A primary click at `pos`, then a few frames.
+ pub fn click_at(h: &mut Harness<'static, Window>, pos: egui::Pos2) {
+ h.hover_at(pos);
+ h.drag_at(pos);
+ h.drop_at(pos);
+ h.run_steps(4);
+ }
}