diff --git a/examples/html/entityList.html b/examples/html/entityList.html index 7caa45f19d..26a302cb41 100644 --- a/examples/html/entityList.html +++ b/examples/html/entityList.html @@ -2,13 +2,30 @@ +
- + + +
- - - - - - - - - -
TypeURL
+
+ + + + + + + + + + +
Type  ▾URL
+
diff --git a/examples/html/style.css b/examples/html/style.css index 7ffbacb15e..12e87baee5 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -114,6 +114,7 @@ table#entity-table { #entity-table tr { cursor: pointer; + border-bottom: 1px solid #e5e5e5; } #entity-table tr.selected { @@ -133,14 +134,18 @@ table#entity-table { border: 0px black solid; word-wrap: nowrap; white-space: nowrap; + text-overflow: ellipsis; +} + +#entity-table td.url { + white-space: nowrap; + overflow: hidden; } th#entity-type { width: 60px; } -th#entity-url { -} div.input-area { @@ -186,3 +191,20 @@ table#properties-table { col#col-label { width: 130px; } + +div.outer { + position: relative; +} +div.inner { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + position: absolute; + width: 100%; +} + +td { + + + vertical-align: top; +} diff --git a/examples/libraries/entityList.js b/examples/libraries/entityList.js index eb01295d97..10a2209309 100644 --- a/examples/libraries/entityList.js +++ b/examples/libraries/entityList.js @@ -24,10 +24,38 @@ EntityListTool = function(opts) { type: 'selectionUpdate', selectedIDs: selectedIDs, }; + print("Sending: " + JSON.stringify(data)); webView.eventBridge.emitScriptEvent(JSON.stringify(data)); }); + function sendUpdate() { + var entities = []; + var ids = Entities.findEntities(MyAvatar.position, 100); + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + var properties = Entities.getEntityProperties(id); + entities.push({ + id: id.id, + type: properties.type, + url: properties.type == "Model" ? properties.modelURL : "", + }); + } + + var selectedIDs = []; + for (var i = 0; i < selectionManager.selections.length; i++) { + selectedIDs.push(selectionManager.selections[i].id); + } + + var data = { + type: "update", + entities: entities, + selectedIDs: selectedIDs, + }; + webView.eventBridge.emitScriptEvent(JSON.stringify(data)); + } + webView.eventBridge.webEventReceived.connect(function(data) { + print("Got: " + data); data = JSON.parse(data); if (data.type == "selectionUpdate") { var ids = data.entityIds; @@ -46,22 +74,13 @@ EntityListTool = function(opts) { Menu.isOptionChecked(MENU_EASE_ON_FOCUS)); } } else if (data.type == "refresh") { - var entities = []; - var ids = Entities.findEntities(MyAvatar.position, 100); - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - var properties = Entities.getEntityProperties(id); - entities.push({ - id: id.id, - type: properties.type, - url: properties.type == "Model" ? properties.modelURL : "", - }); + sendUpdate(); + } else if (data.type == "teleport") { + if (selectionManager.hasSelection()) { + MyAvatar.position = selectionManager.worldPosition; } - var data = { - type: "update", - entities: entities, - }; - webView.eventBridge.emitScriptEvent(JSON.stringify(data)); + } else if (data.type == "delete") { + deleteSelectedEntities(); } });