|
|
@@ -167,6 +167,10 @@ bool Context::Update()
|
|
|
{
|
|
|
RMLUI_ZoneScoped;
|
|
|
|
|
|
+ // Update all data models first
|
|
|
+ for (auto& data_model : data_models)
|
|
|
+ data_model.second->Update(true);
|
|
|
+
|
|
|
root->Update(density_independent_pixel_ratio);
|
|
|
|
|
|
for (int i = 0; i < root->GetNumChildren(); ++i)
|
|
|
@@ -273,6 +277,12 @@ ElementDocument* Context::LoadDocument(Stream* stream)
|
|
|
PluginRegistry::NotifyDocumentLoad(document);
|
|
|
document->DispatchEvent(EventId::Load, Dictionary());
|
|
|
|
|
|
+ // Data models are updated after the 'load' event so that the user has a chance to change
|
|
|
+ // any data variables first. We do not clear dirty variables here, since users may need to
|
|
|
+ // retrieve whether or not eg. a data variable has changed in a controller.
|
|
|
+ for (auto& data_model : data_models)
|
|
|
+ data_model.second->Update(false);
|
|
|
+
|
|
|
document->UpdateDocument();
|
|
|
|
|
|
return document;
|