Browse Source

Drop-down widget: Remove unnecessary box sizing and offset of the value element

The drop-down value element is fully formatted as needed during `OnRender`, so there is no need to set its size and offset during `OnLayout` too.

The two ways to set the value element box were done differently, which caused the box to intermittently change in size every time the layout changed. This could e.g. lead to the decorator data being regenerated.
Michael Ragazzon 7 months ago
parent
commit
e3ac620500
1 changed files with 0 additions and 8 deletions
  1. 0 8
      Source/Core/Elements/WidgetDropDown.cpp

+ 0 - 8
Source/Core/Elements/WidgetDropDown.cpp

@@ -278,14 +278,6 @@ void WidgetDropDown::OnLayout()
 	// Layout the button box. The selection element layout is deferred until it is opened.
 	// Layout the button box. The selection element layout is deferred until it is opened.
 	ElementUtilities::PositionElement(button_element, Vector2f(0, 0), ElementUtilities::TOP_RIGHT);
 	ElementUtilities::PositionElement(button_element, Vector2f(0, 0), ElementUtilities::TOP_RIGHT);
 
 
-	// Calculate the value element position and size.
-	Vector2f size;
-	size.x = parent_element->GetBox().GetSize(BoxArea::Content).x - button_element->GetBox().GetSize(BoxArea::Margin).x;
-	size.y = parent_element->GetBox().GetSize(BoxArea::Content).y;
-
-	value_element->SetOffset(parent_element->GetBox().GetPosition(BoxArea::Content), parent_element);
-	value_element->SetBox(Box(size));
-
 	box_layout_dirty = true;
 	box_layout_dirty = true;
 	value_layout_dirty = true;
 	value_layout_dirty = true;
 }
 }