mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix linearlayout focus grab
This commit is contained in:
parent
3bc07661d0
commit
2db49da1fe
@ -279,11 +279,11 @@ impl LinearLayout {
|
|||||||
// this will give us the allowed window for a click.
|
// this will give us the allowed window for a click.
|
||||||
let child_size = item.child.size.get(self.orientation);
|
let child_size = item.child.size.get(self.orientation);
|
||||||
|
|
||||||
if (item.offset + child_size > position)
|
if item.offset + child_size > position {
|
||||||
&& item.child.view.take_focus(direction::Direction::none())
|
if item.child.view.take_focus(direction::Direction::none())
|
||||||
{
|
{
|
||||||
// eprintln!("It's a match!");
|
self.focus = i;
|
||||||
self.focus = i;
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ use xy::XY;
|
|||||||
use Printer;
|
use Printer;
|
||||||
use With;
|
use With;
|
||||||
|
|
||||||
|
use std::cmp::min;
|
||||||
|
|
||||||
/// Wraps a view in a scrollable area.
|
/// Wraps a view in a scrollable area.
|
||||||
pub struct ScrollView<V> {
|
pub struct ScrollView<V> {
|
||||||
inner_size: Vec2,
|
inner_size: Vec2,
|
||||||
@ -190,7 +192,7 @@ where
|
|||||||
EventResult::Consumed(None)
|
EventResult::Consumed(None)
|
||||||
}
|
}
|
||||||
Event::Mouse { event: MouseEvent::WheelDown, .. } if self.enabled.y && (self.offset.y + self.last_size.y < self.inner_size.y) => {
|
Event::Mouse { event: MouseEvent::WheelDown, .. } if self.enabled.y && (self.offset.y + self.last_size.y < self.inner_size.y) => {
|
||||||
self.offset.y += 3;
|
self.offset.y = min(self.inner_size.y.saturating_sub(self.last_size.y), self.offset.y + 3);
|
||||||
EventResult::Consumed(None)
|
EventResult::Consumed(None)
|
||||||
}
|
}
|
||||||
Event::Ctrl(Key::Up) |
|
Event::Ctrl(Key::Up) |
|
||||||
|
Loading…
Reference in New Issue
Block a user