pub struct UseDrag { /* private fields */ }Implementations§
Source§impl UseDrag
impl UseDrag
Sourcepub fn mount(&self, data: Rc<MountedData>)
pub fn mount(&self, data: Rc<MountedData>)
Examples found in repository?
examples/drag.rs (line 19)
6fn app(cx: Scope) -> Element {
7 let spring_ref = use_spring_style(cx, [0f32, 0f32], |[x, y]| {
8 format!("width: 200px; height: 200px; background: red; transform: translate({x}px, {y}px);")
9 });
10
11 let drag_ref = use_drag(cx, move |state, x, y| match state {
12 DragState::Move => spring_ref.set([x, y]),
13 DragState::End => spring_ref.animate([0., 0.], Duration::from_millis(500)),
14 });
15
16 render!(div {
17 onmounted: move |event| {
18 spring_ref.mount(event.data.clone());
19 drag_ref.mount(event.data);
20 }
21 })
22}Auto Trait Implementations§
impl Freeze for UseDrag
impl !RefUnwindSafe for UseDrag
impl !Send for UseDrag
impl !Sync for UseDrag
impl Unpin for UseDrag
impl !UnwindSafe for UseDrag
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