| ... | ... | @@ -538,22 +538,31 @@ fn gap(ui: &mut Ui, tree: &mut Tree, folder: &str, before: Option<&str>) { |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 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 | 543 | fn unfolding(ui: &mut Ui, part: impl std::hash::Hash, unfolded: bool) -> bool { |
| 543 | 544 | let outer = ui.id(part); |
| 544 | | let rows = ui |
| 545 | | .rect(outer.child("rows")) |
| 546 | | .map_or(0.0, |rect| rect[3] - rect[1]); |
| 547 | | let height = ui.animate(outer, if unfolded { rows } else { 0.0 }); |
| 548 | | if !unfolded && height == 0.0 { |
| 549 | | return false; |
| 550 | | } |
| 545 | let height = if ui.lasted(outer.child("shown"), true).is_zero() { |
| 546 | if !unfolded { |
| 547 | return false; |
| 548 | } |
| 549 | ui::children() |
| 550 | } else { |
| 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 | 560 | ui.open_as( |
| 552 | 561 | outer, |
| 553 | 562 | Spec { |
| 554 | 563 | flags: Flags::CLIP, |
| 555 | 564 | axis: Axis::Y, |
| 556 | | size: [fill(), px(height)], |
| 565 | size: [fill(), height], |
| 557 | 566 | ..Spec::default() |
| 558 | 567 | }, |
| 559 | 568 | ); |