From 3291417b319945de97a48bf9b7e1f592d99c1e6b Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sat, 6 Nov 2021 09:05:38 +0100 Subject: [PATCH] Show and hide navigator. --- website/o3dv/js/navigator.js | 10 +++++++++- website/o3dv/js/panelset.js | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/website/o3dv/js/navigator.js b/website/o3dv/js/navigator.js index d0052bd..474adb7 100644 --- a/website/o3dv/js/navigator.js +++ b/website/o3dv/js/navigator.js @@ -59,6 +59,11 @@ OV.Navigator = class this.panelSet.Init ({ onResize : () => { + if (this.panelSet.IsPanelsVisible ()) { + this.splitterDiv.show (); + } else { + this.splitterDiv.hide (); + } this.callbacks.onResize (); } }); @@ -116,7 +121,10 @@ OV.Navigator = class GetWidth () { let navigatorWidth = parseInt (this.mainDiv.outerWidth (true), 10); - let splitterWidth = parseInt (this.splitterDiv.outerWidth (true), 10); + let splitterWidth = 0; + if (this.panelSet.IsPanelsVisible ()) { + splitterWidth = parseInt (this.splitterDiv.outerWidth (true), 10); + } return navigatorWidth + splitterWidth; } diff --git a/website/o3dv/js/panelset.js b/website/o3dv/js/panelset.js index d9d384f..1a3c560 100644 --- a/website/o3dv/js/panelset.js +++ b/website/o3dv/js/panelset.js @@ -56,6 +56,7 @@ OV.PanelSet = class this.contentDiv = $('
').addClass ('ov_panel_set_content').appendTo (parentDiv); this.panels = []; this.panelsVisible = true; + this.panelsPrevWidth = null; this.callbacks = null; } @@ -75,14 +76,19 @@ OV.PanelSet = class let button = OV.AddSvgIcon (this.menuDiv, panel.GetIcon (), 'ov_panel_set_menu_button'); button.click (() => { if (panel === this.GetVisiblePanel ()) { - //this.ShowPanels (false); + this.ShowPanels (false); } else { - //this.ShowPanels (true); + this.ShowPanels (true); this.ShowPanel (panel); } }); } + IsPanelsVisible () + { + return this.panelsVisible; + } + ShowPanels (show) { if (this.panelsVisible === show) { @@ -92,8 +98,12 @@ OV.PanelSet = class this.panelsVisible = show; if (this.panelsVisible) { this.contentDiv.show (); + this.parentDiv.outerWidth (this.menuDiv.outerWidth (true) + this.panelsPrevWidth, true); + this.callbacks.onResize (); } else { + this.panelsPrevWidth = this.contentDiv.outerWidth (true); this.contentDiv.hide (); + this.parentDiv.outerWidth (this.menuDiv.outerWidth (true), true); this.callbacks.onResize (); } }