diff --git a/crates/gpui/src/presenter.rs b/crates/gpui/src/presenter.rs index 51672e25c775f4f73ae9f5988bcc1cc13f255248..86a8c4cf3049e924cfcea798ae2ff703ea6132d8 100644 --- a/crates/gpui/src/presenter.rs +++ b/crates/gpui/src/presenter.rs @@ -379,11 +379,11 @@ impl Presenter { } } - if let Some((dragged_region, delta, position)) = dragged_region { + if let Some((dragged_region, prev_position, position)) = dragged_region { handled = true; if let Some(drag_callback) = dragged_region.drag { event_cx.with_current_view(dragged_region.view_id, |event_cx| { - drag_callback(delta, position, event_cx); + drag_callback(prev_position, position, event_cx); }) } } diff --git a/crates/workspace/src/sidebar.rs b/crates/workspace/src/sidebar.rs index c31998aa93995ff5f2f58efd8929bcfb4da76410..a500f994924d09aaae9304c2d3c9b0326f8803f7 100644 --- a/crates/workspace/src/sidebar.rs +++ b/crates/workspace/src/sidebar.rs @@ -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();