Show and hide navigator.

This commit is contained in:
kovacsv 2021-11-06 09:05:38 +01:00
parent dede2eaae7
commit 3291417b31
2 changed files with 21 additions and 3 deletions

View File

@ -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;
}

View File

@ -56,6 +56,7 @@ OV.PanelSet = class
this.contentDiv = $('<div>').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 ();
}
}