From 7d74e68c4e468cd9843bdcc6b6b136ed77e1b27a Mon Sep 17 00:00:00 2001 From: Viktor Kovacs Date: Fri, 21 May 2021 10:02:12 +0200 Subject: [PATCH] Remove unnecessary callback. --- website/o3dv/info.js | 10 ++++++---- website/o3dv/menu.js | 2 +- website/o3dv/website.js | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/website/o3dv/info.js b/website/o3dv/info.js index daae11e..2bbe608 100644 --- a/website/o3dv/info.js +++ b/website/o3dv/info.js @@ -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); } }); }); diff --git a/website/o3dv/menu.js b/website/o3dv/menu.js index cdffda7..0cf2400 100644 --- a/website/o3dv/menu.js +++ b/website/o3dv/menu.js @@ -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); }, diff --git a/website/o3dv/website.js b/website/o3dv/website.js index ff55817..ff0b0da 100644 --- a/website/o3dv/website.js +++ b/website/o3dv/website.js @@ -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;