Remove unnecessary callback.

This commit is contained in:
Viktor Kovacs 2021-05-21 10:02:12 +02:00
parent 5184fe9346
commit 7d74e68c4e
3 changed files with 12 additions and 6 deletions

View File

@ -18,7 +18,7 @@ OV.InfoPanel = class
this.detailsItem.SetOpenCloseHandler (openCloseHandler);
}
FillWithMaterialInfo (info, getMeshInfo, callbacks)
FillWithMaterialInfo (info, callbacks)
{
function AddRow (container, name, fillValue)
{
@ -70,7 +70,7 @@ OV.InfoPanel = class
let meshItems = [];
for (let i = 0; i < info.usedByMeshes.length; i++) {
let meshInfo = getMeshInfo (info.usedByMeshes[i]);
let meshInfo = info.usedByMeshes[i];
meshItems.push ({
name : OV.GetMeshName (meshInfo.name)
});
@ -84,13 +84,15 @@ OV.InfoPanel = class
}
obj.popup = OV.ShowListPopup (button, meshItems, {
onHoverStart : function (index) {
callbacks.onMeshHover (info.usedByMeshes[index]);
const meshItem = info.usedByMeshes[index];
callbacks.onMeshHover (meshItem.index);
},
onHoverStop : function (index) {
callbacks.onMeshHover (null);
},
onClick : function (index) {
callbacks.onMeshSelect (info.usedByMeshes[index]);
const meshItem = info.usedByMeshes[index];
callbacks.onMeshSelect (meshItem.index);
}
});
});

View File

@ -229,7 +229,7 @@ OV.Menu = class
} else {
if (this.selection.type === OV.SelectionType.Material) {
let materialInfo = this.callbacks.getMaterialInformation (this.selection.index);
this.infoPanel.FillWithMaterialInfo (materialInfo, this.callbacks.getMeshInformation, {
this.infoPanel.FillWithMaterialInfo (materialInfo, {
onMeshHover : function (meshIndex) {
obj.SetTempSelectedMeshIndex (meshIndex);
},

View File

@ -417,7 +417,11 @@ OV.Website = class
viewer.EnumerateMeshesUserData (function (meshUserData) {
if (meshUserData.originalMaterials.indexOf (materialIndex) !== -1) {
materialInfo.usedByMeshes.push (meshUserData.originalMeshIndex);
const mesh = model.GetMesh (meshUserData.originalMeshIndex);
materialInfo.usedByMeshes.push ({
index : meshUserData.originalMeshIndex,
name : mesh.GetName ()
});
}
});
return materialInfo;