Add "Copy ID"

Add "Copy ID" on entity list menu and contextual menu.
This commit is contained in:
Alezia Kurdis 2024-03-11 22:35:03 -04:00 committed by GitHub
parent 634dc64f8f
commit e802d0ec12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View file

@ -1,6 +1,6 @@
// entityList.js
//
// Created by Ryan Huffman on 19 Nov 2014
// Created by Ryan Huffman on November 19th, 2014
// Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
// Copyright 2024 Overte e.V.
@ -328,6 +328,7 @@ function loaded() {
elToolsMenu = document.getElementById("tools");
elMenuBackgroundOverlay = document.getElementById("menuBackgroundOverlay");
elHmdCopy = document.getElementById("hmdcopy");
elHmdCopyID = document.getElementById("hmdcopyid");
elHmdCut = document.getElementById("hmdcut");
elHmdPaste = document.getElementById("hmdpaste");
elHmdDuplicate = document.getElementById("hmdduplicate");
@ -424,6 +425,10 @@ function loaded() {
EventBridge.emitWebEvent(JSON.stringify({ type: "copy" }));
closeAllEntityListMenu();
};
elHmdCopyID.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: "copyID" }));
closeAllEntityListMenu();
};
elHmdCut.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: "cut" }));
closeAllEntityListMenu();
@ -822,6 +827,9 @@ function loaded() {
case "Copy":
EventBridge.emitWebEvent(JSON.stringify({ type: "copy" }));
break;
case "Copy ID":
EventBridge.emitWebEvent(JSON.stringify({ type: "copyID" }));
break;
case "Paste":
EventBridge.emitWebEvent(JSON.stringify({ type: "paste" }));
break;
@ -862,6 +870,10 @@ function loaded() {
enabledContextMenuItems.push("Rename");
enabledContextMenuItems.push("Delete");
}
if (selectedEntities.length === 1) {
enabledContextMenuItems.push("Copy ID");
}
entityListContextMenu.open(clickEvent, entityID, enabledContextMenuItems);
}

View file

@ -1,9 +1,10 @@
//
// entityListContextMenu.js
//
// exampleContextMenus.js was originally created by David Rowe on 22 Aug 2018.
// Modified to entityListContextMenu.js by Thijs Wenker on 10 Oct 2018
// exampleContextMenus.js was originally created by David Rowe on August 22nd, 2018.
// Modified to entityListContextMenu.js by Thijs Wenker on October 10th, 2018
// Copyright 2018 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -137,6 +138,7 @@ EntityListContextMenu.prototype = {
this._addListItem("Cut");
this._addListItem("Copy");
this._addListItem("Copy ID");
this._addListItem("Paste");
this._addListSeparator();
this._addListItem("Rename");