From 34faf61b46f0cd5fc6c4c509e8b8a442df7d337a Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sun, 7 Nov 2021 17:45:50 +0100 Subject: [PATCH] Highlight currently opened panel's icon. --- website/o3dv/js/panelset.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/website/o3dv/js/panelset.js b/website/o3dv/js/panelset.js index 0702475..c77ae59 100644 --- a/website/o3dv/js/panelset.js +++ b/website/o3dv/js/panelset.js @@ -102,6 +102,9 @@ OV.PanelSet = class this.contentDiv.show (); this.parentDiv.outerWidth (this.menuDiv.outerWidth (true) + this.panelsPrevWidth, true); } else { + for (let otherPanelButton of this.panelButtons) { + otherPanelButton.removeClass ('selected'); + } this.panelsPrevWidth = this.contentDiv.outerWidth (true); this.parentDiv.outerWidth (this.menuDiv.outerWidth (true), true); this.contentDiv.hide (); @@ -113,12 +116,17 @@ OV.PanelSet = class ShowPanel (panel) { - if (panel === this.GetVisiblePanel ()) { - return; - } for (let otherPanel of this.panels) { otherPanel.Show (false); } + + for (let otherPanelButton of this.panelButtons) { + otherPanelButton.removeClass ('selected'); + } + + let panelButton = this.GetPanelButton (panel); + panelButton.addClass ('selected'); + panel.Show (true); panel.Resize (); } @@ -138,11 +146,16 @@ OV.PanelSet = class SetPanelIcon (panel, icon) { - const panelIndex = this.panels.indexOf (panel); - let panelButton = this.panelButtons[panelIndex]; + let panelButton = this.GetPanelButton (panel); OV.SetSvgIconImage (panelButton, icon); } + GetPanelButton (panel) + { + const panelIndex = this.panels.indexOf (panel); + return this.panelButtons[panelIndex]; + } + Resize () { let height = this.parentDiv.height ();