Skip to content

Commit 713c0ca

Browse files
danxuliunextcloud-command
authored andcommitted
fix: Fix content size
The viewer contents are shown with a bottom margin used to "frame" them, but the PDF viewer is expected to cover that bottom margin and use the full height instead. In mobile devices the viewport height might be larger than the actual viewport, for example when special UI elements like the navigation bar are being shown. When that happens, the height of the PDF viewer is larger than the height of its parent plus the bottom margin (as the height of the PDF viewer is based on the viewport size, and the height of its parent is based on the available height), so as the PDF viewer is vertically centered it ends overlapping the header at the top and being cut by the end of the page at the bottom. To solve that, now the height of the PDF viewer is based instead on the height of its parent plus the bottom margin that needs to be covered. Besides that, the top margin in the PDF viewer is used to compensate for the bottom margin in its parent due to being vertically aligned. Although that works this is now also simplified by aligning the top of the PDF viewer to the top of its parent. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent 567a02c commit 713c0ca

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

js/files_pdfviewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/files_pdfviewer-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/PDFView.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,14 @@ export default {
300300
301301
iframe {
302302
width: 100%;
303-
height: calc(100vh - var(--header-height));
304-
margin-top: var(--header-height);
303+
/* The height is increased to cover the full modal content. Note that the
304+
* added height is not related to the header itself, but to the "bottom"
305+
* property of ".modal-container" in the viewer, which just happens to use
306+
* the header height. */
307+
height: calc(100% + var(--header-height));
308+
/* Align the PDF viewer with the top of the viewer content so it appears
309+
* below its header. */
310+
top: 0;
305311
position: absolute;
306312
}
307313

0 commit comments

Comments
 (0)