Updated drag API to pass old,new, instead of delta,new
This commit is contained in:
parent
baa011ccf4
commit
9fd2bf2fa1
2 changed files with 8 additions and 10 deletions
|
@ -188,12 +188,13 @@ impl Sidebar {
|
|||
})
|
||||
.with_cursor_style(CursorStyle::ResizeLeftRight)
|
||||
.on_mouse_down(|_, _| {}) // This prevents the mouse down event from being propagated elsewhere
|
||||
.on_drag(move |delta, _, cx| {
|
||||
.on_drag(move |old_position, new_position, cx| {
|
||||
let delta = new_position.x() - old_position.x();
|
||||
let prev_width = *actual_width.borrow();
|
||||
*custom_width.borrow_mut() = 0f32
|
||||
.max(match side {
|
||||
Side::Left => prev_width + delta.x(),
|
||||
Side::Right => prev_width - delta.x(),
|
||||
Side::Left => prev_width + delta,
|
||||
Side::Right => prev_width - delta,
|
||||
})
|
||||
.round();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue