private void DrawContent() { DrawInFixedRectIfNeeded(() => { float contentHeight = EditorDrawHelper.DrawVertically(_selectionTree.Draw, _preventExpandingHeight, DropdownStyle.BackgroundColor); if (_contentHeight == 0f || Event.current.type == EventType.Repaint) { _contentHeight = contentHeight; } EditorDrawHelper.DrawBorders(position.width, position.height, DropdownStyle.BorderColor); }); }
/// <summary>Draws elements with scrollbar if the list is large enough.</summary> /// <param name="drawContent"> /// Action that takes a visible rect as an argument. Visible rect is the rect where GUI elements are in the /// window borders and are shown on screen. /// </param> public void DrawWithScrollbar(Action <Rect> drawContent) { EditorDrawHelper.DrawVertically(windowRect => { if (Event.current.type == EventType.Repaint) { _windowRect = windowRect; } DrawInScrollView(() => { Rect newWholeListRect = EditorDrawHelper.DrawVertically(() => { drawContent(VisibleRect); }); if (_wholeListRect.height == 0f || Event.current.type == EventType.Repaint) { _visible = _wholeListRect.height > _windowRect.height; _wholeListRect = newWholeListRect; } }); }); ScrollToNodeIfNeeded(); }