diff --git a/src/view/scroll.rs b/src/view/scroll.rs index 9559061..8c5600d 100644 --- a/src/view/scroll.rs +++ b/src/view/scroll.rs @@ -169,7 +169,9 @@ impl ScrollBase { /// Starts scrolling from the given cursor position. pub fn start_drag(&mut self, position: Vec2, width: usize) -> bool { // First: are we on the correct column? - if position.x != self.scrollbar_x(width) { + let scrollbar_x = self.scrollbar_x(width); + // eprintln!("Grabbed {} for {}", position.x, scrollbar_x); + if position.x != scrollbar_x { return false; } @@ -275,6 +277,7 @@ impl ScrollBase { }; let scrollbar_x = self.scrollbar_x(printer.size.x); + // eprintln!("Drawing bar at x={}", scrollbar_x); // The background printer.print_vline((scrollbar_x, 0), printer.size.y, "|"); diff --git a/src/views/shadow_view.rs b/src/views/shadow_view.rs index 9e3f9e0..0e945e5 100644 --- a/src/views/shadow_view.rs +++ b/src/views/shadow_view.rs @@ -24,10 +24,11 @@ impl ShadowView { } fn padding(&self) -> Vec2 { - Vec2::new( - 1 + self.left_padding as usize, - 1 + self.top_padding as usize, - ) + self.top_left_padding() + (1, 1) + } + + fn top_left_padding(&self) -> Vec2 { + Vec2::new(self.left_padding as usize, self.top_padding as usize) } /// If set, adds an empty column to the left of the view. @@ -62,7 +63,8 @@ impl ViewWrapper for ShadowView { } fn wrap_on_event(&mut self, event: Event) -> EventResult { - self.view.on_event(event.relativized((1, 1))) + let padding = self.top_left_padding(); + self.view.on_event(event.relativized(padding)) } fn wrap_draw(&self, printer: &Printer) { diff --git a/src/views/stack_view.rs b/src/views/stack_view.rs index b878af1..1edfa6a 100644 --- a/src/views/stack_view.rs +++ b/src/views/stack_view.rs @@ -191,6 +191,7 @@ impl, I: Iterator> Iterator self.previous = offset; + // eprintln!("{:?}", offset); (v, offset) }) }