diff --git a/website/o3dv/sidebar.js b/website/o3dv/sidebar.js index c71262a..d356fdf 100644 --- a/website/o3dv/sidebar.js +++ b/website/o3dv/sidebar.js @@ -17,7 +17,7 @@ OV.Sidebar = class Show (show) { this.visible = show; - if (show) { + if (this.visible) { this.parentDiv.show (); } else { this.parentDiv.hide (); diff --git a/website/o3dv/website.js b/website/o3dv/website.js index a195fd1..d140738 100644 --- a/website/o3dv/website.js +++ b/website/o3dv/website.js @@ -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); }); } };