From 52f6fe1d041912321eed3aa8e56dfdc2819a702c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 21 Sep 2015 09:59:00 -0700 Subject: [PATCH] Clear entity list when you change domains --- examples/edit.js | 5 +++++ examples/html/entityList.html | 4 +++- examples/libraries/entityList.js | 9 ++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index d778ff324d..d28d51df9d 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -245,6 +245,10 @@ var toolBar = (function () { that.setActive(false); } + that.clearEntityList = function() { + entityListTool.clearEntityList(); + }; + that.setActive = function(active) { if (active != isActive) { if (active && !Entities.canAdjustLocks()) { @@ -510,6 +514,7 @@ var toolBar = (function () { Window.domainChanged.connect(function() { that.setActive(false); + that.clearEntityList(); }); Entities.canAdjustLocksChanged.connect(function(canAdjustLocks) { diff --git a/examples/html/entityList.html b/examples/html/entityList.html index a1ba167652..3a1eeedf95 100644 --- a/examples/html/entityList.html +++ b/examples/html/entityList.html @@ -201,7 +201,9 @@ EventBridge.scriptEventReceived.connect(function(data) { data = JSON.parse(data); - if (data.type == "selectionUpdate") { + if (data.type === "clearEntityList") { + clearEntities(); + } else if (data.type == "selectionUpdate") { var notFound = updateSelectedEntities(data.selectedIDs); if (notFound) { refreshEntities(); diff --git a/examples/libraries/entityList.js b/examples/libraries/entityList.js index 66dc9f336f..bab256dd5b 100644 --- a/examples/libraries/entityList.js +++ b/examples/libraries/entityList.js @@ -26,13 +26,20 @@ EntityListTool = function(opts) { selectedIDs.push(selectionManager.selections[i]); } - data = { + var data = { type: 'selectionUpdate', selectedIDs: selectedIDs, }; webView.eventBridge.emitScriptEvent(JSON.stringify(data)); }); + that.clearEntityList = function () { + var data = { + type: 'clearEntityList' + } + webView.eventBridge.emitScriptEvent(JSON.stringify(data)); + }; + that.sendUpdate = function() { var entities = []; var ids = Entities.findEntities(MyAvatar.position, searchRadius);