changes in TWO entityList.js to register the export event

This commit is contained in:
Faye Li 2017-03-17 16:17:21 -07:00
parent 1a46f18aa3
commit 197a06c423
2 changed files with 16 additions and 0 deletions

View file

@ -40,6 +40,7 @@ function loaded() {
elInView = document.getElementById("in-view")
elRadius = document.getElementById("radius");
elTeleport = document.getElementById("teleport");
elExport = document.getElementById("export");
elPal = document.getElementById("pal");
elEntityTable = document.getElementById("entity-table");
elInfoToggle = document.getElementById("info-toggle");
@ -276,6 +277,9 @@ function loaded() {
elTeleport.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'teleport' }));
}
elExport.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'export'}));
}
elPal.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'pal' }));
}

View file

@ -128,6 +128,18 @@ EntityListTool = function(opts) {
if (selectionManager.hasSelection()) {
MyAvatar.position = selectionManager.worldPosition;
}
} else if (data.type == "export") {
if (!selectionManager.hasSelection()) {
Window.notifyEditError("No entities have been selected.");
} else {
var filename = Window.save("Select Where to Save", "", "*.json");
if (filename) {
var success = Clipboard.exportEntities(filename, selectionManager.selections);
if (!success) {
Window.notifyEditError("Export failed.");
}
}
}
} else if (data.type == "pal") {
var sessionIds = {}; // Collect the sessionsIds of all selected entitities, w/o duplicates.
selectionManager.selections.forEach(function (id) {