mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
Listening for page loaded event instead of set timeout === less lag
This commit is contained in:
parent
46679b29f7
commit
46907f446b
1 changed files with 7 additions and 5 deletions
|
@ -1895,16 +1895,18 @@ entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
||||||
// Now we want to activate the partice explorer panel!
|
// Now we want to activate the partice explorer panel!
|
||||||
particleExplorerTool.createWebView();
|
particleExplorerTool.createWebView();
|
||||||
var properties = Entities.getEntityProperties(ids[0]);
|
var properties = Entities.getEntityProperties(ids[0]);
|
||||||
var data = {
|
var particleData = {
|
||||||
messageType: "particle_settings",
|
messageType: "particle_settings",
|
||||||
currentProperties: properties
|
currentProperties: properties
|
||||||
};
|
};
|
||||||
particleExplorerTool.setActiveParticleEntity(ids[0]);
|
particleExplorerTool.setActiveParticleEntity(ids[0]);
|
||||||
Script.setTimeout(function() {
|
|
||||||
// Wait for event bridge on web side to open
|
|
||||||
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
|
||||||
}, 2000)
|
|
||||||
|
|
||||||
|
particleExplorerTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
||||||
|
var data = JSON.parse(data);
|
||||||
|
if (data.messageType === "page_loaded") {
|
||||||
|
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(particleData));
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
particleExplorerTool.destroyWebView();
|
particleExplorerTool.destroyWebView();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue