mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix linear layout offset check
This commit is contained in:
parent
6f23c355c4
commit
1f1a651371
@ -78,13 +78,16 @@ impl<'a, T: Deref<Target = Child>, I: Iterator<Item = T>> Iterator
|
|||||||
// Save the current offset.
|
// Save the current offset.
|
||||||
let offset = self.offset;
|
let offset = self.offset;
|
||||||
|
|
||||||
// Allocated width
|
// eprintln!("Available: {}", self.available);
|
||||||
self.available = self.available.saturating_sub(offset);
|
|
||||||
|
|
||||||
let length =
|
let length =
|
||||||
usize::min(self.available, *child.size.get(self.orientation));
|
usize::min(self.available, *child.size.get(self.orientation));
|
||||||
|
|
||||||
|
// Allocated width
|
||||||
|
self.available = self.available.saturating_sub(length);
|
||||||
|
|
||||||
self.offset += length;
|
self.offset += length;
|
||||||
|
|
||||||
ChildItem {
|
ChildItem {
|
||||||
offset,
|
offset,
|
||||||
length,
|
length,
|
||||||
@ -282,6 +285,7 @@ fn try_focus(
|
|||||||
impl View for LinearLayout {
|
impl View for LinearLayout {
|
||||||
fn draw(&self, printer: &Printer) {
|
fn draw(&self, printer: &Printer) {
|
||||||
// Use pre-computed sizes
|
// Use pre-computed sizes
|
||||||
|
// eprintln!("Pre loop!");
|
||||||
for (i, item) in ChildIterator::new(
|
for (i, item) in ChildIterator::new(
|
||||||
self.children.iter(),
|
self.children.iter(),
|
||||||
self.orientation,
|
self.orientation,
|
||||||
@ -289,8 +293,8 @@ impl View for LinearLayout {
|
|||||||
).enumerate()
|
).enumerate()
|
||||||
{
|
{
|
||||||
// eprintln!("Printer size: {:?}", printer.size);
|
// eprintln!("Printer size: {:?}", printer.size);
|
||||||
// eprintln!("Child size: {:?}", child.size);
|
// eprintln!("Child size: {:?}", item.child.size);
|
||||||
// eprintln!("Offset: {:?}", offset);
|
// eprintln!("Offset: {:?}", item.offset);
|
||||||
let printer = &printer.sub_printer(
|
let printer = &printer.sub_printer(
|
||||||
self.orientation.make_vec(item.offset, 0),
|
self.orientation.make_vec(item.offset, 0),
|
||||||
item.child.size,
|
item.child.size,
|
||||||
|
Loading…
Reference in New Issue
Block a user