@@ -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)]
@@ -548,12 +548,12 @@ pub trait ElementInteraction<V: 'static + Send + Sync>: '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 {
@@ -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);