Skip to content

Commit c2402e7

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 <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent 9929948 commit c2402e7

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

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
@@ -293,8 +293,14 @@ export default {
293293
294294
iframe {
295295
width: 100%;
296-
height: calc(100vh - var(--header-height));
297-
margin-top: var(--header-height);
296+
/* The height is increased to cover the full modal content. Note that the
297+
* added height is not related to the header itself, but to the "bottom"
298+
* property of ".modal-container" in the viewer, which just happens to use
299+
* the header height. */
300+
height: calc(100% + var(--header-height));
301+
/* Align the PDF viewer with the top of the viewer content so it appears
302+
* below its header. */
303+
top: 0;
298304
position: absolute;
299305
}
300306

0 commit comments

Comments
 (0)