Fix panels visibility.
This commit is contained in:
parent
e2fd0bc65d
commit
cb25414dd2
@ -78,7 +78,7 @@ OV.HideDomElement = function (element)
|
||||
|
||||
OV.IsDomElementVisible = function (element)
|
||||
{
|
||||
return element.style.display !== 'none';
|
||||
return element.offsetParent !== null;
|
||||
};
|
||||
|
||||
OV.SetDomElementWidth = function (element, width)
|
||||
|
||||
@ -53,7 +53,6 @@ OV.PanelSet = class
|
||||
this.panels = [];
|
||||
this.panelButtons = [];
|
||||
this.panelsVisible = true;
|
||||
this.requestedPanelsVisible = true;
|
||||
this.panelsPrevWidth = null;
|
||||
this.callbacks = null;
|
||||
}
|
||||
@ -93,7 +92,6 @@ OV.PanelSet = class
|
||||
ShowPanels (show)
|
||||
{
|
||||
if (!this.IsParentVisible ()) {
|
||||
this.requestedPanelsVisible = show;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -102,7 +100,6 @@ OV.PanelSet = class
|
||||
}
|
||||
|
||||
this.panelsVisible = show;
|
||||
this.requestedPanelsVisible = show;
|
||||
if (this.panelsVisible) {
|
||||
OV.ShowDomElement (this.contentDiv);
|
||||
OV.SetDomElementWidth (this.parentDiv, this.menuDiv.offsetWidth + this.panelsPrevWidth);
|
||||
@ -172,10 +169,6 @@ OV.PanelSet = class
|
||||
|
||||
Resize ()
|
||||
{
|
||||
if (this.requestedPanelsVisible !== this.panelsVisible) {
|
||||
this.ShowPanels (this.requestedPanelsVisible);
|
||||
return;
|
||||
}
|
||||
let height = this.parentDiv.offsetHeight;
|
||||
OV.SetDomElementHeight (this.menuDiv, height);
|
||||
OV.SetDomElementHeight (this.contentDiv, height);
|
||||
|
||||
@ -26,6 +26,12 @@ OV.IsHoverEnabled = function ()
|
||||
return window.matchMedia ('(hover: hover)').matches;
|
||||
};
|
||||
|
||||
OV.AddSmallWidthChangeEventListener = function (onChange)
|
||||
{
|
||||
let mediaQuery = window.matchMedia ('(max-width: 800px)');
|
||||
mediaQuery.addEventListener ('change', onChange);
|
||||
};
|
||||
|
||||
OV.IsSmallWidth = function ()
|
||||
{
|
||||
return window.matchMedia ('(max-width: 800px)').matches;
|
||||
|
||||
@ -47,6 +47,10 @@ OV.Website = class
|
||||
this.hashHandler.SetEventListener (this.OnHashChange.bind (this));
|
||||
this.OnHashChange ();
|
||||
|
||||
OV.AddSmallWidthChangeEventListener (() => {
|
||||
this.OnSmallWidthChanged ();
|
||||
});
|
||||
|
||||
window.addEventListener ('resize', () => {
|
||||
this.Resize ();
|
||||
});
|
||||
@ -79,6 +83,11 @@ OV.Website = class
|
||||
this.viewer.Resize (contentWidth, contentHeight);
|
||||
}
|
||||
|
||||
OnSmallWidthChanged ()
|
||||
{
|
||||
this.UpdatePanelsVisibility ();
|
||||
}
|
||||
|
||||
HasLoadedModel ()
|
||||
{
|
||||
return this.model !== null;
|
||||
@ -100,6 +109,7 @@ OV.Website = class
|
||||
OV.HideDomElement (this.parameters.introDiv);
|
||||
OV.ShowDomElement (this.parameters.mainDiv);
|
||||
ShowOnlyOnModelElements (true);
|
||||
this.UpdatePanelsVisibility ();
|
||||
} else if (uiState === OV.WebsiteUIState.Loading) {
|
||||
OV.HideDomElement (this.parameters.introDiv);
|
||||
OV.HideDomElement (this.parameters.mainDiv);
|
||||
@ -548,9 +558,6 @@ OV.Website = class
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
let showSidebar = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
|
||||
this.sidebar.ShowPanels (showSidebar);
|
||||
}
|
||||
|
||||
InitNavigator ()
|
||||
@ -650,9 +657,14 @@ OV.Website = class
|
||||
this.cookieHandler.SetBoolVal ('ov_show_navigator', show);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
UpdatePanelsVisibility ()
|
||||
{
|
||||
let showNavigator = this.cookieHandler.GetBoolVal ('ov_show_navigator', true);
|
||||
let showSidebar = this.cookieHandler.GetBoolVal ('ov_show_sidebar', true);
|
||||
this.navigator.ShowPanels (showNavigator);
|
||||
this.sidebar.ShowPanels (showSidebar);
|
||||
}
|
||||
|
||||
InitCookieConsent ()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user