diff --git a/examples/html/entityList.html b/examples/html/entityList.html index 62bbbd08a6..2e3fdb1874 100644 --- a/examples/html/entityList.html +++ b/examples/html/entityList.html @@ -20,7 +20,9 @@ elRefresh = document.getElementById("refresh"); elDelete = document.getElementById("delete"); elTeleport = document.getElementById("teleport"); + elRadius = document.getElementById("radius"); elNoEntitiesMessage = document.getElementById("no-entities"); + elNoEntitiesRadius = document.getElementById("no-entities-radius"); document.getElementById("entity-name").onclick = function() { setSortColumn('name'); @@ -186,6 +188,13 @@ } }, false); + elRadius.onchange = function () { + elRadius.value = Math.max(elRadius.value, 0); + EventBridge.emitWebEvent(JSON.stringify({ type: 'radius', radius: elRadius.value })); + refreshEntities(); + elNoEntitiesRadius.firstChild.nodeValue = elRadius.value; + } + if (window.EventBridge !== undefined) { EventBridge.scriptEventReceived.connect(function(data) { data = JSON.parse(data); @@ -218,14 +227,15 @@
- - - + + +
+  m
@@ -246,7 +256,7 @@
- No entities found within 50 meter radius. Try moving to a different location and refreshing. + No entities found within a 100 meter radius. Try moving to a different location and refreshing.
diff --git a/examples/html/style.css b/examples/html/style.css index e63b6338fc..3614ea821b 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -102,13 +102,23 @@ input[type=button] { } #search-area { - width: 100%; padding: 0.5em; box-sizing: border-box; + padding-right: 6em; } -#search-area input { - width: 100%; +#filter { + width: 99%; +} + +#radius-and-unit { + width: 6em; + float: right; + margin-right: -6em; +} + +#radius { + width: 4em; } textarea, input { diff --git a/examples/libraries/entityList.js b/examples/libraries/entityList.js index 0fd1cd5a06..66dc9f336f 100644 --- a/examples/libraries/entityList.js +++ b/examples/libraries/entityList.js @@ -4,6 +4,8 @@ EntityListTool = function(opts) { var url = Script.resolvePath('html/entityList.html'); var webView = new WebWindow('Entities', url, 200, 280, true); + var searchRadius = 100; + var visible = false; webView.setVisible(visible); @@ -33,7 +35,7 @@ EntityListTool = function(opts) { that.sendUpdate = function() { var entities = []; - var ids = Entities.findEntities(MyAvatar.position, 100); + var ids = Entities.findEntities(MyAvatar.position, searchRadius); for (var i = 0; i < ids.length; i++) { var id = ids[i]; var properties = Entities.getEntityProperties(id); @@ -80,6 +82,9 @@ EntityListTool = function(opts) { } } else if (data.type == "delete") { deleteSelectedEntities(); + } else if (data.type === "radius") { + searchRadius = data.radius; + that.sendUpdate(); } });