trying to destroy web window

This commit is contained in:
ericrius1 2016-02-01 15:23:54 -08:00
parent 0bd6d22611
commit 25d5904d2d
2 changed files with 11 additions and 10 deletions

View file

@ -1884,7 +1884,6 @@ var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
propertiesTool = PropertiesTool();
var particleExplorerTool = ParticleExplorerTool();
particleExplorerTool.createWebView();
entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
var data = JSON.parse(data);
if (data.type == "selectionUpdate") {
@ -1892,19 +1891,19 @@ entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
if(ids.length === 1) {
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") {
// Now we want to activate the partice explorer panel!
particleExplorerTool.createWebView();
print("EBL ACTIVATE PARTICLE EXPLORER");
particleExplorerTool.setVisible(true);
var properties = Entities.getEntityProperties(ids[0]);
var data = {
messageType: "particle_settings",
currentProperties: properties
};
particleExplorerTool.setActiveParticleEntity(ids[0]);
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data));
} else {
particleExplorerTool.setVisible(false);
print("EBL CLOSE WEB VIEW")
particleExplorerTool.destroyWebView();
}
}
}

View file

@ -11,11 +11,17 @@ ParticleExplorerTool = function() {
toolWindow: true
});
var visible = false;
that.webView.setVisible(visible);
that.webView.setVisible(true);
that.webView.eventBridge.webEventReceived.connect(that.webEventReceived);
}
that.destroyWebView = function() {
print("EBL DESTROY WEB VIEW" + that.webView);
that.webView.close();
that.webView = null;
}
that.webEventReceived = function(data) {
var data = JSON.parse(data);
if (data.messageType === "settings_update") {
@ -28,10 +34,6 @@ ParticleExplorerTool = function() {
that.activeParticleEntity = id;
}
that.setVisible = function(newVisible) {
visible = newVisible;
that.webView.setVisible(visible);
}
return that;