From bffb7916966a384d46caafa837d8c0b8170a8be7 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Fri, 30 Jul 2021 13:29:44 +0200 Subject: [PATCH] Hide isolation option when there is only one mesh in the model. --- website/o3dv/navigator.js | 5 +++++ website/o3dv/website.js | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/website/o3dv/navigator.js b/website/o3dv/navigator.js index 581043f..213f572 100644 --- a/website/o3dv/navigator.js +++ b/website/o3dv/navigator.js @@ -213,6 +213,11 @@ OV.Navigator = class this.UpdateInfoPanel (); this.Resize (); } + + MeshCount () + { + return this.modelData.MeshCount (); + } IsMeshVisible (meshIndex) { diff --git a/website/o3dv/website.js b/website/o3dv/website.js index 40df733..93e84e1 100644 --- a/website/o3dv/website.js +++ b/website/o3dv/website.js @@ -165,7 +165,6 @@ OV.Website = class } } else { let meshIndex = meshUserData.originalMeshIndex; - let isMeshIsolated = this.navigator.IsMeshIsolated (meshIndex); items.push ({ name : 'Hide mesh', icon : 'assets/images/context/hide.svg', @@ -180,13 +179,16 @@ OV.Website = class this.navigator.FitMeshToWindow (meshIndex); } }); - items.push ({ - name : isMeshIsolated ? 'Remove isolation' : 'Isolate mesh', - icon : isMeshIsolated ? 'assets/images/context/deisolate.svg' : 'assets/images/context/isolate.svg', - onClick : () => { - this.navigator.IsolateMesh (meshIndex); - } - }); + if (this.navigator.MeshCount () > 1) { + let isMeshIsolated = this.navigator.IsMeshIsolated (meshIndex); + items.push ({ + name : isMeshIsolated ? 'Remove isolation' : 'Isolate mesh', + icon : isMeshIsolated ? 'assets/images/context/deisolate.svg' : 'assets/images/context/isolate.svg', + onClick : () => { + this.navigator.IsolateMesh (meshIndex); + } + }); + } } this.dialog = OV.ShowListPopup (items, { calculatePosition : (contentDiv) => {