Misc cleanup (#3935)

* Improve docstring
* Nicer welcome gif in README
* Misc cleanup
This commit is contained in:
Emil Ernerfeldt
2024-02-01 17:09:35 +01:00
committed by GitHub
parent 1db291721f
commit 67b796faee
12 changed files with 32 additions and 33 deletions
+2 -2
View File
@@ -455,7 +455,7 @@ impl ScrollStyle {
pub fn thin() -> Self {
Self {
floating: true,
bar_width: 12.0,
bar_width: 10.0,
floating_allocated_width: 6.0,
foreground_color: false,
@@ -479,7 +479,7 @@ impl ScrollStyle {
pub fn floating() -> Self {
Self {
floating: true,
bar_width: 12.0,
bar_width: 10.0,
foreground_color: true,
floating_allocated_width: 0.0,
dormant_background_opacity: 0.0,
+3 -6
View File
@@ -30,6 +30,7 @@ use crate::{
/// ```
pub struct Ui {
/// ID of this ui.
///
/// Generated based on id of parent ui together with
/// another source of child identity (e.g. window title).
/// Acts like a namespace for child uis.
@@ -38,6 +39,7 @@ pub struct Ui {
id: Id,
/// This is used to create a unique interact ID for some widgets.
///
/// This value is based on where in the hierarchy of widgets this Ui is in,
/// and the value is increment with each added child widget.
/// This works as an Id source only as long as new widgets aren't added or removed.
@@ -99,7 +101,6 @@ impl Ui {
crate::egui_assert!(!max_rect.any_nan());
let next_auto_id_source = Id::new(self.next_auto_id_source).with("child").value();
self.next_auto_id_source = self.next_auto_id_source.wrapping_add(1);
let menu_state = self.menu_state();
Ui {
id: self.id.with(id_source),
next_auto_id_source,
@@ -107,7 +108,7 @@ impl Ui {
style: self.style.clone(),
placer: Placer::new(max_rect, layout),
enabled: self.enabled,
menu_state,
menu_state: self.menu_state.clone(),
}
}
@@ -2232,10 +2233,6 @@ impl Ui {
self.menu_state = None;
}
pub(crate) fn menu_state(&self) -> Option<Arc<RwLock<MenuState>>> {
self.menu_state.clone()
}
pub(crate) fn set_menu_state(&mut self, menu_state: Option<Arc<RwLock<MenuState>>>) {
self.menu_state = menu_state;
}
+2
View File
@@ -79,6 +79,8 @@ impl<'a> DragValue<'a> {
}
/// How much the value changes when dragged one point (logical pixel).
///
/// Should be finite and greater than zero.
#[inline]
pub fn speed(mut self, speed: impl Into<f64>) -> Self {
self.speed = speed.into();