Skip to content

Commit

Permalink
feat: ability to show/hide the whole top bar via showTopBar
Browse files Browse the repository at this point in the history
  • Loading branch information
seankmartin committed Mar 11, 2025
1 parent 7681ed7 commit 3b238bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/neuroglancer/viewer_config_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ class ConfigState(JsonObjectWrapper):
show_ui_controls = showUIControls = wrapped_property(
"showUIControls", optional(bool, True)
)
show_top_bar = showTopBar = wrapped_property("showTopBar", optional(bool, True))
show_location = showLocation = wrapped_property(
"showLocation", optional(bool, True)
)
Expand Down
14 changes: 13 additions & 1 deletion src/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const VIEWER_UI_CONTROL_CONFIG_OPTIONS = [

export const VIEWER_UI_CONFIG_OPTIONS = [
...VIEWER_UI_CONTROL_CONFIG_OPTIONS,
"showTopBar",
"showUIControls",
"showPanelBorders",
] as const;
Expand Down Expand Up @@ -472,9 +473,20 @@ export class Viewer extends RefCounted implements ViewerState {

private makeUiControlVisibilityState(key: keyof ViewerUIOptions) {
const showUIControls = this.uiConfiguration.showUIControls;
const showTopBar = this.uiConfiguration.showTopBar;
const option = this.uiConfiguration[key];
const isTopBarControl = (
VIEWER_TOP_ROW_CONFIG_OPTIONS as readonly string[]
).includes(key as string);
return this.registerDisposer(
makeDerivedWatchableValue((a, b) => a && b, showUIControls, option),
makeDerivedWatchableValue(
(a, b, c) => {
return a && (!isTopBarControl || b) && c;
},
showUIControls,
showTopBar,
option,
),
);
}

Expand Down

0 comments on commit 3b238bc

Please sign in to comment.