Browse Source

Update scroll element fully on construction. Scrollbars now appear on the same frame they are activated, instead of one frame later.

Michael Ragazzon 5 years ago
parent
commit
35ca5e43e2
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Source/Core/ElementScroll.cpp

+ 3 - 1
Source/Core/ElementScroll.cpp

@@ -29,6 +29,7 @@
 #include "../../Include/RmlUi/Core/ElementScroll.h"
 #include "LayoutDetails.h"
 #include "WidgetScroll.h"
+#include "../../Include/RmlUi/Core/Context.h"
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
 #include "../../Include/RmlUi/Core/Event.h"
@@ -226,7 +227,8 @@ bool ElementScroll::CreateScrollbar(Orientation orientation)
 	Element* child = element->AppendChild(std::move(scrollbar_element), false);
 
 	// The construction of scrollbars can occur during layouting, then we need some properties and computed values straight away.
-	child->UpdateProperties();
+	Context* context = element->GetContext();
+	child->Update(context ? context->GetDensityIndependentPixelRatio() : 1.0f);
 
 	return true;
 }