mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
Deactivate event handler when webgui is hidden
This commit is contained in:
@@ -91,7 +91,9 @@ void CefWebGuiModule::startOrStopGui() {
|
||||
_instance->initialize();
|
||||
_instance->loadUrl(_url);
|
||||
}
|
||||
webBrowserModule->attachEventHandler(_instance.get());
|
||||
if (_visible) {
|
||||
webBrowserModule->attachEventHandler(_instance.get());
|
||||
}
|
||||
webBrowserModule->addBrowser(_instance.get());
|
||||
} else if (_instance) {
|
||||
_instance->close(true);
|
||||
@@ -121,6 +123,14 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
|
||||
}
|
||||
});
|
||||
|
||||
_visible.onChange([this, webBrowserModule]() {
|
||||
if (_visible && _instance) {
|
||||
webBrowserModule->attachEventHandler(_instance.get());
|
||||
} else {
|
||||
webBrowserModule->detachEventHandler();
|
||||
}
|
||||
});
|
||||
|
||||
_url = configuration.value<std::string>(GuiUrlInfo.identifier);
|
||||
|
||||
_enabled = configuration.hasValue<bool>(EnabledInfo.identifier) &&
|
||||
|
||||
Reference in New Issue
Block a user