Skip to content

Commit

Permalink
feat(ui): initial version of tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
seankmartin committed Sep 27, 2024
1 parent 9b4c306 commit c9eb62a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/ui/screenshot_menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@
.neuroglancer-screenshot-warning {
color: red;
}

.neuroglancer-screenshot-tooltip {
user-select: none;
text-align: center;
padding: 0.1em;
border: 0.1em solid black;
width: 1.1em;
height: 1.1em;
border-radius: 100%;
}
28 changes: 27 additions & 1 deletion src/ui/screenshot_menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ export class ScreenshotDialog extends Overlay {
}
}

private setupHelpTooltips() {
const generalSettingsTooltip = document.createElement("div");
generalSettingsTooltip.classList.add("neuroglancer-screenshot-tooltip");
generalSettingsTooltip.title =
"In the main viewer, see the settings (cog icon, top right) for options to turn off the axis line indicators, the scale bar, and the default annotations (yellow bounding box)";
generalSettingsTooltip.textContent = "?";

const orthographicSettingsTooltip = document.createElement("div");
orthographicSettingsTooltip.classList.add("neuroglancer-screenshot-tooltip");
orthographicSettingsTooltip.title =
"In the main viewer, press 'o' to toggle between perspective and orthographic views";
orthographicSettingsTooltip.textContent = "?";

return { generalSettingsTooltip, orthographicSettingsTooltip };
}

private initializeUI() {
this.content.classList.add("neuroglancer-screenshot-dialog");

Expand All @@ -174,10 +190,20 @@ export class ScreenshotDialog extends Overlay {
this.filenameAndButtonsContainer.appendChild(this.takeScreenshotButton);
this.filenameAndButtonsContainer.appendChild(this.forceScreenshotButton);

this.content.appendChild(this.closeMenuButton);
const tooltip = this.setupHelpTooltips();

const closeAndHelpContainer = document.createElement("div");
closeAndHelpContainer.classList.add(
"neuroglancer-screenshot-close-and-help",
);
closeAndHelpContainer.appendChild(tooltip.generalSettingsTooltip);
closeAndHelpContainer.appendChild(this.closeMenuButton);

this.content.appendChild(closeAndHelpContainer);
this.content.appendChild(this.cancelScreenshotButton);
this.content.appendChild(this.filenameAndButtonsContainer);
this.content.appendChild(this.createScaleRadioButtons());
this.content.appendChild(tooltip.orthographicSettingsTooltip);
this.content.appendChild(this.createPanelResolutionTable());
this.content.appendChild(this.createLayerResolutionTable());
this.content.appendChild(this.createStatisticsTable());
Expand Down

0 comments on commit c9eb62a

Please sign in to comment.