diff --git a/website/o3dv/js/navigator.js b/website/o3dv/js/navigator.js index c3d19c0..bc14a7b 100644 --- a/website/o3dv/js/navigator.js +++ b/website/o3dv/js/navigator.js @@ -184,7 +184,7 @@ OV.Navigator = class browseButton.OnClick (() => { this.callbacks.openFileBrowserDialog (); }); - item.AddButton (browseButton); + item.AppendButton (browseButton); missingFilesItem.AddChild (item); } } @@ -203,13 +203,14 @@ OV.Navigator = class materialsItem.AddChild (materialItem); } - this.FillMeshTree (model); + const isFlat = !OV.FeatureSet.NavigatorTree; + this.FillMeshTree (model, isFlat); this.UpdateInfoPanel (); this.Resize (); } - FillMeshTree (model) + FillMeshTree (model, isFlat) { function AddMeshToNodeTree (navigator, model, node, meshIndex, parentItem) { @@ -247,15 +248,15 @@ OV.Navigator = class return nodeItem; } - function AddModelNodeToTree (navigator, model, node, parentItem) + function AddModelNodeToTree (navigator, model, node, parentItem, isFlat) { for (let childNode of node.GetChildNodes ()) { - if (OV.FeatureSet.NavigatorTree) { + if (isFlat) { + AddModelNodeToTree (navigator, model, childNode, parentItem, isFlat); + } else { let nodeItem = CreateNodeItem (navigator, node.GetName (), null, childNode); parentItem.AddChild (nodeItem); - AddModelNodeToTree (navigator, model, childNode, nodeItem); - } else { - AddModelNodeToTree (navigator, model, childNode, parentItem); + AddModelNodeToTree (navigator, model, childNode, nodeItem, isFlat); } } @@ -269,7 +270,7 @@ OV.Navigator = class this.treeView.AddItem (meshesItem); meshesItem.ShowChildren (true, null); - AddModelNodeToTree (this, model, rootNode, meshesItem); + AddModelNodeToTree (this, model, rootNode, meshesItem, isFlat); } MeshItemCount () diff --git a/website/o3dv/js/navigatoritems.js b/website/o3dv/js/navigatoritems.js index b038deb..a70aeba 100644 --- a/website/o3dv/js/navigatoritems.js +++ b/website/o3dv/js/navigatoritems.js @@ -22,13 +22,13 @@ OV.MeshItem = class extends OV.TreeViewButtonItem this.fitToWindowButton.OnClick (() => { callbacks.onFitToWindow (this.meshInstanceId); }); - this.AddButton (this.fitToWindowButton); + this.AppendButton (this.fitToWindowButton); this.showHideButton = new OV.TreeViewButton ('visible'); this.showHideButton.OnClick (() => { callbacks.onShowHide (this.meshInstanceId); }); - this.AddButton (this.showHideButton); + this.AppendButton (this.showHideButton); this.OnClick (() => { callbacks.onSelected (this.meshInstanceId); @@ -69,13 +69,13 @@ OV.NodeItem = class extends OV.TreeViewGroupButtonItem this.fitToWindowButton.OnClick (() => { callbacks.onFitToWindow (nodeId); }); - this.AddButton (this.fitToWindowButton); + this.AppendButton (this.fitToWindowButton); this.showHideButton = new OV.TreeViewButton ('visible'); this.showHideButton.OnClick (() => { callbacks.onShowHide (nodeId); }); - this.AddButton (this.showHideButton); + this.AppendButton (this.showHideButton); } IsVisible () diff --git a/website/o3dv/js/treeview.js b/website/o3dv/js/treeview.js index bf87c31..f5d4d52 100644 --- a/website/o3dv/js/treeview.js +++ b/website/o3dv/js/treeview.js @@ -29,9 +29,9 @@ OV.TreeViewButton = class }); } - AddDomElements (parentDiv) + GetDomElement () { - this.mainElement.appendTo (parentDiv); + return this.mainElement; } }; @@ -102,9 +102,14 @@ OV.TreeViewButtonItem = class extends OV.TreeViewSingleItem this.buttonsDiv = $('