Store navigator and sidebar opened/closed state in cookie.
This commit is contained in:
parent
34faf61b46
commit
4694fe640a
@ -53,14 +53,16 @@ OV.Navigator = class
|
||||
this.panelSet.ShowPanel (this.meshesPanel);
|
||||
}
|
||||
|
||||
ShowPanels (show)
|
||||
{
|
||||
this.panelSet.ShowPanels (show);
|
||||
}
|
||||
|
||||
Init (callbacks)
|
||||
{
|
||||
this.callbacks = callbacks;
|
||||
|
||||
this.panelSet.Init ({
|
||||
onShowHidePanels : (show) => {
|
||||
|
||||
},
|
||||
onResize : () => {
|
||||
if (this.panelSet.IsPanelsVisible ()) {
|
||||
this.splitterDiv.show ();
|
||||
@ -68,7 +70,10 @@ OV.Navigator = class
|
||||
this.splitterDiv.hide ();
|
||||
}
|
||||
this.callbacks.onResize ();
|
||||
}
|
||||
},
|
||||
onShowHidePanels : (show) => {
|
||||
this.callbacks.onShowHidePanels (show);
|
||||
},
|
||||
});
|
||||
|
||||
this.filesPanel.Init ({
|
||||
|
||||
@ -57,6 +57,7 @@ OV.PanelSet = class
|
||||
this.panels = [];
|
||||
this.panelButtons = [];
|
||||
this.panelsVisible = true;
|
||||
this.requestedPanelsVisible = true;
|
||||
this.panelsPrevWidth = null;
|
||||
this.callbacks = null;
|
||||
}
|
||||
@ -93,11 +94,17 @@ OV.PanelSet = class
|
||||
|
||||
ShowPanels (show)
|
||||
{
|
||||
if (!this.IsParentVisible ()) {
|
||||
this.requestedPanelsVisible = show;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.panelsVisible === show) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.panelsVisible = show;
|
||||
this.requestedPanelsVisible = show;
|
||||
if (this.panelsVisible) {
|
||||
this.contentDiv.show ();
|
||||
this.parentDiv.outerWidth (this.menuDiv.outerWidth (true) + this.panelsPrevWidth, true);
|
||||
@ -158,6 +165,9 @@ OV.PanelSet = class
|
||||
|
||||
Resize ()
|
||||
{
|
||||
if (this.requestedPanelsVisible !== this.isPanelsVisible) {
|
||||
this.ShowPanels (this.requestedPanelsVisible);
|
||||
}
|
||||
let height = this.parentDiv.height ();
|
||||
this.menuDiv.outerHeight (height, true);
|
||||
this.contentDiv.outerHeight (height, true);
|
||||
@ -166,6 +176,11 @@ OV.PanelSet = class
|
||||
}
|
||||
}
|
||||
|
||||
IsParentVisible ()
|
||||
{
|
||||
return this.parentDiv.is (':visible');
|
||||
}
|
||||
|
||||
Clear ()
|
||||
{
|
||||
for (let panel of this.panels) {
|
||||
|
||||
@ -28,9 +28,6 @@ OV.Sidebar = class
|
||||
this.callbacks = callbacks;
|
||||
|
||||
this.panelSet.Init ({
|
||||
onShowHidePanels : (show) => {
|
||||
this.callbacks.onShowHidePanels (show);
|
||||
},
|
||||
onResize : () => {
|
||||
if (this.panelSet.IsPanelsVisible ()) {
|
||||
//this.splitterDiv.show ();
|
||||
@ -38,6 +35,9 @@ OV.Sidebar = class
|
||||
//this.splitterDiv.hide ();
|
||||
}
|
||||
this.callbacks.onResize ();
|
||||
},
|
||||
onShowHidePanels : (show) => {
|
||||
this.callbacks.onShowHidePanels (show);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -40,7 +40,9 @@ OV.Website = class
|
||||
|
||||
this.viewer.SetClickHandler (this.OnModelClicked.bind (this));
|
||||
this.viewer.SetContextMenuHandler (this.OnModelContextMenu.bind (this));
|
||||
|
||||
this.Resize ();
|
||||
this.SetUIState (OV.WebsiteUIState.Intro);
|
||||
|
||||
this.hashHandler.SetEventListener (this.OnHashChange.bind (this));
|
||||
this.OnHashChange ();
|
||||
@ -338,7 +340,6 @@ OV.Website = class
|
||||
'assets/envmaps/grayclouds/posz.jpg',
|
||||
'assets/envmaps/grayclouds/negz.jpg'
|
||||
]);
|
||||
this.SetUIState (OV.WebsiteUIState.Intro);
|
||||
}
|
||||
|
||||
InitToolbar ()
|
||||
@ -529,10 +530,13 @@ OV.Website = class
|
||||
this.Resize ();
|
||||
},
|
||||
onShowHidePanels : (show) => {
|
||||
|
||||
this.cookieHandler.SetBoolVal ('ov_show_sidebar', show);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
let showSidebar = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
|
||||
this.sidebar.ShowPanels (showSidebar);
|
||||
}
|
||||
|
||||
InitNavigator ()
|
||||
@ -627,8 +631,14 @@ OV.Website = class
|
||||
},
|
||||
onResize : () => {
|
||||
this.Resize ();
|
||||
},
|
||||
onShowHidePanels : (show) => {
|
||||
this.cookieHandler.SetBoolVal ('ov_show_navigator', show);
|
||||
}
|
||||
});
|
||||
|
||||
let showNavigator = this.cookieHandler.GetBoolVal ('ov_show_navigator', true);
|
||||
this.navigator.ShowPanels (showNavigator);
|
||||
}
|
||||
|
||||
InitCookieConsent ()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user