Misc cleanup (#3935)
* Improve docstring * Nicer welcome gif in README * Misc cleanup
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user