pub struct DragState {
pub dragging: Option<WidgetId>,
pub start_pos: (f64, f64),
pub current_pos: (f64, f64),
pub offset: (f64, f64),
pub initial_value: f64,
}Expand description
Widget drag state
Fields§
§dragging: Option<WidgetId>Widget being dragged
start_pos: (f64, f64)Drag start position
current_pos: (f64, f64)Current drag position
offset: (f64, f64)Drag offset from widget origin
initial_value: f64Initial value when drag started (for sliders, scrollbars)
Implementations§
Source§impl DragState
impl DragState
pub fn new() -> Self
Sourcepub fn start(
&mut self,
id: WidgetId,
x: f64,
y: f64,
offset_x: f64,
offset_y: f64,
)
pub fn start( &mut self, id: WidgetId, x: f64, y: f64, offset_x: f64, offset_y: f64, )
Start dragging a widget
Sourcepub fn start_with_value(&mut self, id: WidgetId, x: f64, y: f64, value: f64)
pub fn start_with_value(&mut self, id: WidgetId, x: f64, y: f64, value: f64)
Start dragging with initial value
Sourcepub fn is_dragging(&self, id: &WidgetId) -> bool
pub fn is_dragging(&self, id: &WidgetId) -> bool
Check if a widget is being dragged
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DragState
impl RefUnwindSafe for DragState
impl Send for DragState
impl Sync for DragState
impl Unpin for DragState
impl UnsafeUnpin for DragState
impl UnwindSafe for DragState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more