Browse Source

Revert "Allow UIElements to keep their current size if greater than the calculated size during layout updates."

This reverts commit b97c8d4712957a3953fa06e15e89b00d5b15df6d.

FileSelector or the editor's hierarchy window would not resize to smaller properly if the amount of items in the list was being reduced. The MinSize attribute should be used to absolutely prevent layouting making an element smaller.
Lasse Öörni 11 years ago
parent
commit
4f8bc4a9f2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/Engine/UI/UIElement.cpp

+ 2 - 2
Source/Engine/UI/UIElement.cpp

@@ -1070,7 +1070,7 @@ void UIElement::UpdateLayout()
 
         CalculateLayout(positions, sizes, minSizes, maxSizes, flexScales, GetWidth(), layoutBorder_.left_, layoutBorder_.right_, layoutSpacing_);
 
-        int width = Max(GetWidth(), CalculateLayoutParentSize(sizes, layoutBorder_.left_, layoutBorder_.right_, layoutSpacing_));
+        int width = CalculateLayoutParentSize(sizes, layoutBorder_.left_, layoutBorder_.right_, layoutSpacing_);
         int height = Max(GetHeight(), minChildHeight + layoutBorder_.top_ + layoutBorder_.bottom_);
         int minWidth = Min(CalculateLayoutParentSize(minSizes, layoutBorder_.left_, layoutBorder_.right_, layoutSpacing_), maxSize_.x_);
         int minHeight = Min(minChildHeight + layoutBorder_.top_ + layoutBorder_.bottom_, maxSize_.y_);
@@ -1112,7 +1112,7 @@ void UIElement::UpdateLayout()
 
         CalculateLayout(positions, sizes, minSizes, maxSizes, flexScales, GetHeight(), layoutBorder_.top_, layoutBorder_.bottom_, layoutSpacing_);
 
-        int height = Max(GetHeight(), CalculateLayoutParentSize(sizes, layoutBorder_.top_, layoutBorder_.bottom_, layoutSpacing_));
+        int height = CalculateLayoutParentSize(sizes, layoutBorder_.top_, layoutBorder_.bottom_, layoutSpacing_);
         int width = Max(GetWidth(), minChildWidth + layoutBorder_.left_ + layoutBorder_.right_);
         int minHeight = Min(CalculateLayoutParentSize(minSizes, layoutBorder_.top_, layoutBorder_.bottom_, layoutSpacing_), maxSize_.y_);
         int minWidth = Min(minChildWidth + layoutBorder_.left_ + layoutBorder_.right_, maxSize_.x_);