From 25d5904d2d0e70cd8189d6127e9fb1fe2bcd4640 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 1 Feb 2016 15:23:54 -0800 Subject: [PATCH] trying to destroy web window --- examples/edit.js | 7 +++---- examples/particle_explorer/particleExplorerTool.js | 14 ++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 634f7bbc61..9619951529 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -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(); } } } diff --git a/examples/particle_explorer/particleExplorerTool.js b/examples/particle_explorer/particleExplorerTool.js index d1a5791cce..439c00699b 100644 --- a/examples/particle_explorer/particleExplorerTool.js +++ b/examples/particle_explorer/particleExplorerTool.js @@ -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;