mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 23:02:24 +02:00
Merge pull request #865 from AleziaKurdis/CreateAppCopyID
Create app: Entity List: "Copy ID" on menu and contextual menu.
This commit is contained in:
commit
f1475e49ee
6 changed files with 43 additions and 8 deletions
|
@ -351,6 +351,8 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
|
|||
that.selectionManager.cutSelectedEntities();
|
||||
} else if (data.type === "copy") {
|
||||
that.selectionManager.copySelectedEntities();
|
||||
} else if (data.type === "copyID") {
|
||||
that.selectionManager.copyIdsFromSelectedEntities();
|
||||
} else if (data.type === "paste") {
|
||||
that.selectionManager.pasteEntities();
|
||||
} else if (data.type === "duplicate") {
|
||||
|
|
|
@ -122,6 +122,12 @@
|
|||
<div class = "menu-item-shortcut">Ctrl-C</div>
|
||||
</div>
|
||||
</button>
|
||||
<button class="menu-button" id="hmdcopyid" >
|
||||
<div class = "menu-item">
|
||||
<div class = "menu-item-caption">Copy ID(s)</div>
|
||||
<div class = "menu-item-shortcut"></div>
|
||||
</div>
|
||||
</button>
|
||||
<button class="menu-button" id="hmdpaste" >
|
||||
<div class = "menu-item">
|
||||
<div class = "menu-item-caption">Paste</div>
|
||||
|
|
|
@ -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(s)":
|
||||
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 !== 0) {
|
||||
enabledContextMenuItems.push("Copy ID(s)");
|
||||
}
|
||||
|
||||
entityListContextMenu.open(clickEvent, entityID, enabledContextMenuItems);
|
||||
}
|
||||
|
|
|
@ -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(s)");
|
||||
this._addListItem("Paste");
|
||||
this._addListSeparator();
|
||||
this._addListItem("Rename");
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
//
|
||||
// entitySelectionTool.js
|
||||
//
|
||||
// Created by Brad hefta-Gaub on 10/1/14.
|
||||
// Modified by Daniela Fontes * @DanielaFifo and Tiago Andrade @TagoWill on 4/7/2017
|
||||
// Modified by David Back on 1/9/2018
|
||||
// Created by Brad hefta-Gaub on October 1st, 2014.
|
||||
// Modified by Daniela Fontes * @DanielaFifo and Tiago Andrade @TagoWill on April 7th, 2017
|
||||
// Modified by David Back on January 9th, 2018
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
// Copyright 2020 Vircadia contributors
|
||||
// Copyright 2022-2023 Overte e.V.
|
||||
// Copyright 2022-2024 Overte e.V.
|
||||
//
|
||||
// This script implements a class useful for building tools for editing entities.
|
||||
//
|
||||
|
@ -496,6 +496,18 @@ SelectionManager = (function() {
|
|||
that.createApp.deleteSelectedEntities();
|
||||
};
|
||||
|
||||
that.copyIdsFromSelectedEntities = function() {
|
||||
if (that.selections.length === 0) {
|
||||
audioFeedback.rejection();
|
||||
} else if (that.selections.length === 1) {
|
||||
Window.copyToClipboard(that.selections[0]);
|
||||
audioFeedback.confirmation();
|
||||
} else {
|
||||
Window.copyToClipboard(JSON.stringify(that.selections));
|
||||
audioFeedback.confirmation();
|
||||
}
|
||||
};
|
||||
|
||||
that.copySelectedEntities = function() {
|
||||
var entityProperties = Entities.getMultipleEntityProperties(that.selections);
|
||||
var entityHostTypes = Entities.getMultipleEntityProperties(that.selections, 'entityHostType');
|
||||
|
|
|
@ -1776,6 +1776,7 @@ input#property-scale-button-reset {
|
|||
display: none;
|
||||
position: fixed;
|
||||
color: #000000;
|
||||
font-family: FiraSans-SemiBold;
|
||||
background-color: #afafaf;
|
||||
padding: 5px 0 5px 0;
|
||||
cursor: default;
|
||||
|
@ -1795,7 +1796,7 @@ input#property-scale-button-reset {
|
|||
padding: 0 0;
|
||||
}
|
||||
.context-menu li.disabled {
|
||||
color: #333333;
|
||||
color: #777777;
|
||||
}
|
||||
.context-menu li.separator:hover, .context-menu li.disabled:hover {
|
||||
background-color: #afafaf;
|
||||
|
|
Loading…
Reference in a new issue