diff --git a/website/o3dv/js/navigator.js b/website/o3dv/js/navigator.js index 7f2899c..d0052bd 100644 --- a/website/o3dv/js/navigator.js +++ b/website/o3dv/js/navigator.js @@ -57,16 +57,24 @@ OV.Navigator = class { this.callbacks = callbacks; + this.panelSet.Init ({ + onResize : () => { + this.callbacks.onResize (); + } + }); + this.filesPanel.Init ({ onFileBrowseButtonClicked : () => { this.callbacks.openFileBrowserDialog (); } }); + this.materialsPanel.Init ({ onMaterialSelected : (materialIndex) => { this.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex)); } }); + this.meshesPanel.Init ({ onMeshSelected : (meshId) => { this.SetSelection (new OV.Selection (OV.SelectionType.Mesh, meshId)); diff --git a/website/o3dv/js/panelset.js b/website/o3dv/js/panelset.js index 6e90b12..d9d384f 100644 --- a/website/o3dv/js/panelset.js +++ b/website/o3dv/js/panelset.js @@ -24,6 +24,10 @@ OV.Panel = class Show (show) { + if (this.visible === show) { + return; + } + this.visible = show; if (this.visible) { this.panelDiv.show (); @@ -51,6 +55,13 @@ OV.PanelSet = class this.menuDiv = $('
').addClass ('ov_panel_set_menu').appendTo (parentDiv); this.contentDiv = $('
').addClass ('ov_panel_set_content').appendTo (parentDiv); this.panels = []; + this.panelsVisible = true; + this.callbacks = null; + } + + Init (callbacks) + { + this.callbacks = callbacks; } GetContentDiv () @@ -63,10 +74,30 @@ OV.PanelSet = class this.panels.push (panel); let button = OV.AddSvgIcon (this.menuDiv, panel.GetIcon (), 'ov_panel_set_menu_button'); button.click (() => { - this.ShowPanel (panel); + if (panel === this.GetVisiblePanel ()) { + //this.ShowPanels (false); + } else { + //this.ShowPanels (true); + this.ShowPanel (panel); + } }); } + ShowPanels (show) + { + if (this.panelsVisible === show) { + return; + } + + this.panelsVisible = show; + if (this.panelsVisible) { + this.contentDiv.show (); + } else { + this.contentDiv.hide (); + this.callbacks.onResize (); + } + } + ShowPanel (panel) { if (panel === this.GetVisiblePanel ()) { @@ -81,6 +112,9 @@ OV.PanelSet = class GetVisiblePanel () { + if (!this.panelsVisible) { + return null; + } for (let panel of this.panels) { if (panel.IsVisible ()) { return panel;