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

View file

@ -11,11 +11,17 @@ ParticleExplorerTool = function() {
toolWindow: true toolWindow: true
}); });
var visible = false; that.webView.setVisible(true);
that.webView.setVisible(visible);
that.webView.eventBridge.webEventReceived.connect(that.webEventReceived); 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) { that.webEventReceived = function(data) {
var data = JSON.parse(data); var data = JSON.parse(data);
if (data.messageType === "settings_update") { if (data.messageType === "settings_update") {
@ -28,10 +34,6 @@ ParticleExplorerTool = function() {
that.activeParticleEntity = id; that.activeParticleEntity = id;
} }
that.setVisible = function(newVisible) {
visible = newVisible;
that.webView.setVisible(visible);
}
return that; return that;