Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the size of the toolbar depending on the uidensity (bug 1171799) #18786

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion web/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,18 @@ class Toolbar {
this.reset();
}

#updateToolbarDensity() {}
#updateToolbarDensity({ value }) {
let name = "normal";
switch (value) {
case 1:
name = "compact";
break;
case 2:
name = "touch";
break;
}
document.documentElement.setAttribute("data-toolbar-density", name);
}

#setAnnotationEditorUIManager(uiManager, parentContainer) {
const colorPicker = new ColorPicker({ uiManager });
Expand Down
14 changes: 13 additions & 1 deletion web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@
}
}

html {
&[data-toolbar-density="compact"] {
--toolbar-height: 30px;
}
&[data-toolbar-density="touch"] {
--toolbar-height: 44px;
}
}

html,
body {
height: 100%;
Expand Down Expand Up @@ -1093,6 +1102,10 @@ dialog :link {
height: 100%;
}

.menu {
padding-block: 5px;
}

.menuContainer {
width: 100%;
height: auto;
Expand All @@ -1103,7 +1116,6 @@ dialog :link {
display: flex;
flex-direction: column;
box-sizing: border-box;
padding-block: 5px;
overflow-y: auto;
}

Expand Down
4 changes: 2 additions & 2 deletions web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
<button id="editorStampButton" class="toolbarButton" type="button" disabled="disabled" title="Add or edit images" role="radio" aria-expanded="false" aria-haspopup="true" aria-controls="editorStampParamsToolbar" tabindex="0" data-l10n-id="pdfjs-editor-stamp-button">
<span data-l10n-id="pdfjs-editor-stamp-button-label">Add or edit images</span>
</button>
<div class="editorParamsToolbar hidden doorHangerRight" id="editorStampParamsToolbar">
<div class="editorParamsToolbar hidden doorHangerRight menu" id="editorStampParamsToolbar">
<div class="menuContainer">
<button id="editorStampAddImage" class="toolbarButton labeled" type="button" title="Add image" tabindex="0" data-l10n-id="pdfjs-editor-stamp-add-image-button">
<span class="editorParamsLabel" data-l10n-id="pdfjs-editor-stamp-add-image-button-label">Add image</span>
Expand Down Expand Up @@ -335,7 +335,7 @@
<button id="secondaryToolbarToggleButton" class="toolbarButton" type="button" title="Tools" tabindex="0" data-l10n-id="pdfjs-tools-button" aria-expanded="false" aria-haspopup="true" aria-controls="secondaryToolbar">
<span data-l10n-id="pdfjs-tools-button-label">Tools</span>
</button>
<div id="secondaryToolbar" class="hidden doorHangerRight">
<div id="secondaryToolbar" class="hidden doorHangerRight menu">
<div id="secondaryToolbarButtonContainer" class="menuContainer">
<!--#if GENERIC-->
<button id="secondaryOpenFile" class="toolbarButton labeled" type="button" title="Open File" tabindex="0" data-l10n-id="pdfjs-open-file-button">
Expand Down