| ... | @@ -538,22 +538,31 @@ fn gap(ui: &mut Ui, tree: &mut Tree, folder: &str, before: Option<&str>) { | ... | @@ -538,22 +538,31 @@ fn gap(ui: &mut Ui, tree: &mut Tree, folder: &str, before: Option<&str>) { |
| 538 | } | 538 | } |
| 539 | | 539 | |
| 540 | /// Opens the boxes a notebook's or group's rows ease open and shut in, where they show: | 540 | /// Opens the boxes a notebook's or group's rows ease open and shut in, where they show: |
| 541 | /// the caller builds the rows and closes both. | 541 | /// the caller builds the rows and closes both. Rows appearing with the tree, as the sidebar |
| | 542 | /// opens or a notebook's sections arrive, show as they stand; only a toggle eases. |
| 542 | fn unfolding(ui: &mut Ui, part: impl std::hash::Hash, unfolded: bool) -> bool { | 543 | fn unfolding(ui: &mut Ui, part: impl std::hash::Hash, unfolded: bool) -> bool { |
| 543 | let outer = ui.id(part); | 544 | let outer = ui.id(part); |
| 544 | let rows = ui | 545 | let height = if ui.lasted(outer.child("shown"), true).is_zero() { |
| 545 | .rect(outer.child("rows")) | 546 | if !unfolded { |
| 546 | .map_or(0.0, |rect| rect[3] - rect[1]); | 547 | return false; |
| 547 | let height = ui.animate(outer, if unfolded { rows } else { 0.0 }); | 548 | } |
| 548 | if !unfolded && height == 0.0 { | 549 | ui::children() |
| 549 | return false; | 550 | } else { |
| 550 | } | 551 | let rows = ui |
| | 552 | .rect(outer.child("rows")) |
| | 553 | .map_or(0.0, |rect| rect[3] - rect[1]); |
| | 554 | let height = ui.animate(outer, if unfolded { rows } else { 0.0 }); |
| | 555 | if !unfolded && height == 0.0 { |
| | 556 | return false; |
| | 557 | } |
| | 558 | px(height) |
| | 559 | }; |
| 551 | ui.open_as( | 560 | ui.open_as( |
| 552 | outer, | 561 | outer, |
| 553 | Spec { | 562 | Spec { |
| 554 | flags: Flags::CLIP, | 563 | flags: Flags::CLIP, |
| 555 | axis: Axis::Y, | 564 | axis: Axis::Y, |
| 556 | size: [fill(), px(height)], | 565 | size: [fill(), height], |
| 557 | ..Spec::default() | 566 | ..Spec::default() |
| 558 | }, | 567 | }, |
| 559 | ); | 568 | ); |