Skip to content

Commit

Permalink
Prevent hiding the menu bar in tabbed mode
Browse files Browse the repository at this point in the history
Tabbed mode doesn't have a menu bar, instead it has tabs. These can't be
hidden. Unfortunately, the post messages to hide the menu bar have the
side effect of hiding the tabs. This commit prevents the tabs being
hidden when in tabbed mode, and shows the tabs again when switching from
compact mode into tabbed mode.

When switching back from tabbed into compact mode, the state that you
would like the menu bar to be in (hidden/shown) will be remembered and
restored. This includes any postmessages that were not acted on while in
tabbed mode.

Signed-off-by: Skyler Grey <[email protected]>
Change-Id: I1177903fe965e354538e6e7bbc3c83af3177938e
  • Loading branch information
Minion3665 committed Nov 14, 2023
1 parent 9115d9d commit 7380bf2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion browser/src/control/Control.UIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ L.Control.UIManager = L.Control.extend({
this.map._docLayer._requestNewTiles();

this.map.topToolbar.updateControlsState();

if (this._menubarShouldBeHidden)
this.hideMenubar();
},

createNotebookbarControl: function(docType) {
Expand Down Expand Up @@ -496,6 +499,9 @@ L.Control.UIManager = L.Control.extend({
this.refreshNotebookbar();
this.map._docLayer._resetClientVisArea();
this.map._docLayer._requestNewTiles();
var menubarWasHidden = this.isMenubarHidden();
this.showMenubar();
this._menubarShouldBeHidden = menubarWasHidden;
},

removeNotebookbarUI: function() {
Expand Down Expand Up @@ -663,6 +669,7 @@ L.Control.UIManager = L.Control.extend({
// Menubar

showMenubar: function() {
this._menubarShouldBeHidden = false;
if (!this.isMenubarHidden())
return;
$('.main-nav').show();
Expand All @@ -680,7 +687,8 @@ L.Control.UIManager = L.Control.extend({
},

hideMenubar: function() {
if (this.isMenubarHidden())
this._menubarShouldBeHidden = true;
if (this.isMenubarHidden() || this.shouldUseNotebookbarMode())
return;

var notebookbarWasCollapsed = this.isNotebookbarCollapsed();
Expand Down

0 comments on commit 7380bf2

Please sign in to comment.