Copy mesh name to clipboard.

This commit is contained in:
kovacsv 2018-12-25 11:37:12 +01:00
parent 028182dd60
commit a0b86b1790
3 changed files with 49 additions and 30 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

@ -174,11 +174,26 @@ table.infotable
table.infotable td
{
background : #d2d2d2;
background : #d0d0d0;
padding : 4px 5px;
border : 1px solid #aaaaaa;
}
div.meshbuttons
{
}
div.meshbuttons img.meshimgbutton
{
background : #dddddd;
padding : 3px;
border : 1px solid #aaaaaa;
border-radius : 3px;
margin-right : 3px;
cursor : pointer;
}
div.importerdialog
{
width : 450px;

View File

@ -233,31 +233,38 @@ ImporterApp.prototype.GenerateMenu = function ()
function AddMesh (importerApp, importerMenu, meshesGroup, mesh, meshIndex)
{
function AddMeshButtons (contentDiv, mesh)
{
function CopyToClipboard (text) {
var input = document.createElement ('input');
input.style.position = 'absolute';
input.style.left = '0';
input.style.top = '0';
input.setAttribute ('value', text);
document.body.appendChild (input);
input.select ();
document.execCommand ('copy');
document.body.removeChild(input)
}
var meshButtons = $('<div>').addClass ('meshbuttons').appendTo (contentDiv);
var fitInWindowButton = $('<img>').addClass ('meshimgbutton').attr ('src', 'images/fitinwindowsmall.png').attr ('title', 'Fit Mesh In Window').appendTo (meshButtons);
fitInWindowButton.click (function () {
importerApp.FitMeshInWindow (meshIndex);
});
var copyNameToClipboardButton = $('<img>').addClass ('meshimgbutton').attr ('src', 'images/copytoclipboard.png').attr ('title', 'Copy Mesh Name To Clipboard').appendTo (meshButtons);
copyNameToClipboardButton.click (function () {
CopyToClipboard (mesh.name);
});
}
var meshItem = meshesGroup.AddSubItem (mesh.name, {
openCloseButton : {
title : 'Show/Hide Details',
},
userButtons : [
{
id : 'showhidemesh-' + meshIndex,
title : 'Show/Hide Mesh',
onCreate : function (image) {
image.attr ('src', 'images/visible.png');
},
onClick : function (image, meshIndex) {
var visible = importerApp.ShowHideMesh (meshIndex);
image.attr ('src', visible ? 'images/visible.png' : 'images/hidden.png');
},
userData : meshIndex
}
]
});
meshItem.AddSubItem ('Information', {
openCloseButton : {
title : 'Show/Hide Information',
onOpen : function (contentDiv, mesh) {
contentDiv.empty ();
AddMeshButtons (contentDiv, mesh);
var table = new InfoTable (contentDiv);
var min = new JSM.Coord (JSM.Inf, JSM.Inf, JSM.Inf);
@ -287,20 +294,17 @@ ImporterApp.prototype.GenerateMenu = function ()
table.AddRow ('Triangle count', triangleCount);
},
userData : mesh
}
});
meshItem.AddSubItem ('Fit In Window', {
title : 'Fit In Window',
},
userButtons : [
{
id : 'fitinwindow-' + meshIndex,
title : 'Fit In Window',
id : 'showhidemesh-' + meshIndex,
title : 'Show/Hide Mesh',
onCreate : function (image) {
image.attr ('src', 'images/fitinwindowsmall.png');
image.attr ('src', 'images/visible.png');
},
onClick : function (image, meshIndex) {
importerApp.FitMeshInWindow (meshIndex);
var visible = importerApp.ShowHideMesh (meshIndex);
image.attr ('src', visible ? 'images/visible.png' : 'images/hidden.png');
},
userData : meshIndex
}