Store sidebar visibility status.

This commit is contained in:
kovacsv 2021-06-20 10:44:18 +02:00
parent e61aabd77c
commit b0a5388c12
2 changed files with 18 additions and 7 deletions

View File

@ -17,7 +17,7 @@ OV.Sidebar = class
Show (show)
{
this.visible = show;
if (show) {
if (this.visible) {
this.parentDiv.show ();
} else {
this.parentDiv.hide ();

View File

@ -29,6 +29,7 @@ OV.Website = class
this.InitToolbar ();
this.InitDragAndDrop ();
this.InitModelLoader ();
this.InitSidebar ();
this.InitNavigator ();
this.InitCookieConsent ();
@ -80,6 +81,13 @@ OV.Website = class
}
}
ShowSidebar (show)
{
this.sidebar.Show (show);
this.cookieHandler.SetBoolVal ('ov_show_sidebar', show);
this.Resize ();
}
ClearModel ()
{
if (this.dialog !== null) {
@ -323,9 +331,7 @@ OV.Website = class
});
}
AddRightButton (this.toolbar, 'details', 'Details Panel', true, function () {
let isVisible = obj.sidebar.IsVisible ();
obj.sidebar.Show (!isVisible);
obj.Resize ();
obj.ShowSidebar (!obj.sidebar.IsVisible ());
});
this.parameters.fileInput.on ('change', function (ev) {
@ -376,6 +382,12 @@ OV.Website = class
});
}
InitSidebar ()
{
let show = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
this.ShowSidebar (show);
}
InitNavigator ()
{
function GetMeshUserData (viewer, meshIndex)
@ -465,15 +477,14 @@ OV.Website = class
InitCookieConsent ()
{
let cookieConsentKey = 'ov_cookie_consent';
let accepted = this.cookieHandler.GetBoolVal (cookieConsentKey, false);
let accepted = this.cookieHandler.GetBoolVal ('ov_cookie_consent', false);
if (accepted) {
return;
}
let obj = this;
OV.ShowCookieDialog (function () {
obj.cookieHandler.SetBoolVal (cookieConsentKey, true);
obj.cookieHandler.SetBoolVal ('ov_cookie_consent', true);
});
}
};