pdf-viewer: various visual and usability changes

- fix page nav buttons, smaller default pages, violet bg

  - Build toolbar after renderAllPages so it queries existing canvases;
    query canvases fresh in the scroll handler so page tracking works
    after re-render (zoom in/out).
  - Default data-pdf-scale 0.85 (JS fallback 0.8) so pages are a bit
    smaller by default.
  - Add dark transparent violet background (accent-secondary 22%) to
    .pdf-expanded, behind the pages.

  - expand to fill column top-to-bottom via CSS flex

    Use a flex chain (.tfe-files flex:1, .tfe-file-item:has(.pdf-expanded)
    flex:1) so the expanded PDF wrapper fills the right column from under
    the header to the bottom of the viewport, instead of viewport-based
    clamp math that didn't account for the header height.

  - fill right column, center pages, freeze column on expand

  The expanded viewer now stays inside the right column instead of
  growing the page: the column switches to overflow:hidden while the
  PDF panel scrolls internally. Pages are centered horizontally via
  flexbox align-items: center.

  - fix toolbar not full-width, hide sibling file items

  The toolbar was constrained by the parent's align-items:center; fixed
  with align-self:stretch. Hiding sibling .tfe-file-item elements when
  a PDF is expanded prevents them from rendering above the overlay.

  - disable overscroll on expanded view

  - use overscroll-behavior-y on container, none on toolbar

  - disable body overscroll via .pdf-viewer-open class

  - mobile full-viewport, iframe matches pdf height

  - mobile overlay above everything via position:fixed

  - opaque dark-violet bg on mobile overlay

  - tfe: add 'Open in new tab' link above website iframes

  - trim column padding when expanded for more vertical space

  - 5% zoom increments, subtle padding on expanded column

  - prevent horizontal overflow/overscroll
This commit is contained in:
Pontoporeia
2026-07-08 22:41:52 +02:00
parent 82d8eff512
commit 20873f94af
4 changed files with 99 additions and 18 deletions
+7 -1
View File
@@ -386,10 +386,16 @@
?>
<div class="pdf-embed-wrapper"
data-pdf-url="<?= $mediaUrl ?>"
data-pdf-scale="1"
data-pdf-scale="0.85"
data-pdf-label="<?= htmlspecialchars($_pdfLabel) ?>"
tabindex="-1"></div>
<?php elseif ($isWebsite): ?>
<a href="<?= $mediaUrl ?>"
class="tfe-website-link"
target="_blank"
rel="noopener noreferrer">
Ouvrir dans un nouvel onglet ↗
</a>
<iframe src="<?= $mediaUrl ?>"
class="tfe-file-iframe"
title="<?= $fileName ?>"