diff --git a/crates/gpui2/src/geometry.rs b/crates/gpui2/src/geometry.rs index 923bb0bf9f68cf598da1982d1de0494b1e9afb73..b472d77f574db56f13a4ebd0e655de9bd1f8b0fd 100644 --- a/crates/gpui2/src/geometry.rs +++ b/crates/gpui2/src/geometry.rs @@ -8,7 +8,7 @@ use std::{ }; #[derive( - Refineable, Default, Add, AddAssign, Sub, SubAssign, Copy, Debug, PartialEq, Eq, Hash, Neg, + Refineable, Default, Add, AddAssign, Sub, SubAssign, Copy, Debug, PartialEq, Eq, Hash, )] #[refineable(debug)] #[repr(C)] diff --git a/crates/gpui2/src/interactive.rs b/crates/gpui2/src/interactive.rs index aeaa5b959af087610a0b4c55bf72323b6195c408..194e6824ef97f39a96802736a0a68d23281344fc 100644 --- a/crates/gpui2/src/interactive.rs +++ b/crates/gpui2/src/interactive.rs @@ -548,12 +548,12 @@ pub trait ElementInteraction: 'static + Send + Sync { if overflow.x == Overflow::Scroll { scroll_offset.x = - (scroll_offset.x - delta.x).clamp(px(0.), scroll_max.width); + (scroll_offset.x + delta.x).clamp(-scroll_max.width, px(0.)); } if overflow.y == Overflow::Scroll { scroll_offset.y = - (scroll_offset.y - delta.y).clamp(px(0.), scroll_max.height); + (scroll_offset.y + delta.y).clamp(-scroll_max.height, px(0.)); } if *scroll_offset != old_scroll_offset { diff --git a/crates/gpui2/src/window.rs b/crates/gpui2/src/window.rs index 0211c8d9a17bb4f10b6b01a17bfafdb451d17270..33b6daeb224e3bf21393e1e64244e92be53bb418 100644 --- a/crates/gpui2/src/window.rs +++ b/crates/gpui2/src/window.rs @@ -469,7 +469,7 @@ impl<'a, 'w> WindowContext<'a, 'w> { .layout_engine .layout_bounds(layout_id) .map(Into::into); - bounds.origin -= self.element_offset(); + bounds.origin += self.element_offset(); bounds } @@ -812,7 +812,7 @@ impl<'a, 'w> WindowContext<'a, 'w> { if let Some(mut active_drag) = cx.active_drag.take() { cx.stack(1, |cx| { - let mouse_position = -cx.mouse_position(); + let mouse_position = cx.mouse_position(); cx.with_element_offset(Some(mouse_position), |cx| { let available_space = size(AvailableSpace::MinContent, AvailableSpace::MinContent);