fix(new_editor): stabilize inspector add-component layout and project browser scrolling
This commit is contained in:
@@ -100,18 +100,29 @@ Widgets::UIEditorPropertyGridLayout TranslatePropertyGridLayoutForScroll(
|
||||
return translated;
|
||||
}
|
||||
|
||||
float ResolvePropertyGridContentBottom(
|
||||
const Widgets::UIEditorPropertyGridLayout& gridLayout,
|
||||
const UIRect& contentBounds) {
|
||||
float contentBottom = contentBounds.y;
|
||||
if (!gridLayout.sectionHeaderRects.empty()) {
|
||||
const UIRect& lastSectionRect = gridLayout.sectionHeaderRects.back();
|
||||
contentBottom =
|
||||
(std::max)(contentBottom, lastSectionRect.y + lastSectionRect.height);
|
||||
}
|
||||
if (!gridLayout.fieldRowRects.empty()) {
|
||||
const UIRect& lastFieldRect = gridLayout.fieldRowRects.back();
|
||||
contentBottom =
|
||||
(std::max)(contentBottom, lastFieldRect.y + lastFieldRect.height);
|
||||
}
|
||||
|
||||
return contentBottom;
|
||||
}
|
||||
|
||||
float ResolveAddComponentButtonTop(
|
||||
const Widgets::UIEditorPropertyGridLayout& gridLayout,
|
||||
const UIRect& contentBounds) {
|
||||
if (!gridLayout.fieldRowRects.empty()) {
|
||||
const UIRect& lastFieldRect = gridLayout.fieldRowRects.back();
|
||||
return lastFieldRect.y + lastFieldRect.height + kAddComponentButtonTopGap;
|
||||
}
|
||||
if (!gridLayout.sectionHeaderRects.empty()) {
|
||||
const UIRect& lastSectionRect = gridLayout.sectionHeaderRects.back();
|
||||
return lastSectionRect.y + lastSectionRect.height + kAddComponentButtonTopGap;
|
||||
}
|
||||
return contentBounds.y;
|
||||
return ResolvePropertyGridContentBottom(gridLayout, contentBounds) +
|
||||
kAddComponentButtonTopGap;
|
||||
}
|
||||
|
||||
Widgets::UIEditorScrollViewPalette BuildInspectorScrollPalette() {
|
||||
@@ -342,13 +353,7 @@ float InspectorPanel::MeasureScrollableContentHeight(
|
||||
m_presentation.sections,
|
||||
m_sectionExpansion,
|
||||
::XCEngine::UI::Editor::GetUIEditorFixedPropertyGridMetrics());
|
||||
if (!layout.fieldRowRects.empty()) {
|
||||
const UIRect& lastFieldRect = layout.fieldRowRects.back();
|
||||
contentBottom = lastFieldRect.y + lastFieldRect.height;
|
||||
} else if (!layout.sectionHeaderRects.empty()) {
|
||||
const UIRect& lastSectionRect = layout.sectionHeaderRects.back();
|
||||
contentBottom = lastSectionRect.y + lastSectionRect.height;
|
||||
}
|
||||
contentBottom = ResolvePropertyGridContentBottom(layout, contentBounds);
|
||||
}
|
||||
|
||||
if (ShouldShowAddComponentButton()) {
|
||||
|
||||
Reference in New Issue
Block a user