| 587 | } |
| 588 | |
| 589 | private void Arrange() |
| 590 | { |
| 591 | // Arrange anchored controls |
| 592 | GetDesireClientArea(out var clientArea); |
| 593 | float dropOffset = _cachedHeight * (_isClosed ? _animationProgress : 1.0f - _animationProgress); |
| 594 | clientArea.Location.Y -= dropOffset; |
| 595 | UpdateChildrenBounds(); |
| 596 | |
| 597 | // Arrange scrollable controls |
| 598 | var slotsMargin = _itemsMargin; |
| 599 | var slotsLeft = clientArea.Left + slotsMargin.Left; |
| 600 | var slotsWidth = clientArea.Width - slotsMargin.Width; |
| 601 | float minHeight = HeaderHeight; |
| 602 | float y = clientArea.Top + slotsMargin.Top; |
| 603 | bool anyAdded = false; |
| 604 | for (int i = 0; i < _children.Count; i++) |
| 605 | { |
| 606 | Control c = _children[i]; |
| 607 | if (c.IsScrollable && c.Visible) |
| 608 | { |
| 609 | var h = c.Height; |
| 610 | c.Bounds = new Rectangle(slotsLeft, y, slotsWidth, h); |
| 611 | h += _itemsSpacing; |
| 612 | y += h; |
| 613 | anyAdded = true; |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | // Update panel height |
| 618 | if (anyAdded) |
| 619 | y -= _itemsSpacing; |
| 620 | if (anyAdded) |
| 621 | y += slotsMargin.Bottom; |
| 622 | float height = dropOffset + y; |
| 623 | _cachedHeight = height; |
| 624 | if (_animationProgress >= 1.0f && _isClosed) |
| 625 | y = minHeight; |
| 626 | var size = new Float2(Width, Mathf.Max(minHeight, y)); |
| 627 | Resize(ref size); |
| 628 | } |
| 629 | |
| 630 | /// <inheritdoc /> |
| 631 | protected override void PerformLayoutBeforeChildren() |