mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 07:11:18 +02:00
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:
@@ -57,6 +57,8 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-m);
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.tfe-file-item {
|
||||
@@ -70,6 +72,30 @@
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.tfe-file-item:has(.pdf-expanded) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.tfe-file-item:has(.tfe-file-iframe) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* When a PDF is expanded, freeze the right column and hide
|
||||
sibling file items so they can't render above the expanded view.
|
||||
Also trim column padding so the PDF fills more vertical space. */
|
||||
.tfe-right-column:has(.pdf-expanded) {
|
||||
overflow: hidden;
|
||||
padding-top: var(--space-xs);
|
||||
padding-bottom: var(--space-xs);
|
||||
}
|
||||
.tfe-right-column:has(.pdf-expanded) .tfe-file-item:not(:has(.pdf-expanded)) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tfe-file-item img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
@@ -95,11 +121,29 @@
|
||||
.tfe-file-iframe {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
height: clamp(300px, 80vh, 700px);
|
||||
height: 100%;
|
||||
min-height: 400px;
|
||||
display: block;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.tfe-website-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3xs);
|
||||
padding: var(--space-2xs) var(--space-xs);
|
||||
font-size: var(--step--1);
|
||||
color: var(--accent-primary);
|
||||
text-decoration: none;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
margin-bottom: var(--space-2xs);
|
||||
}
|
||||
|
||||
.tfe-website-link:hover {
|
||||
background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary));
|
||||
}
|
||||
|
||||
.tfe-file-item figcaption {
|
||||
font-size: var(--step--2);
|
||||
color: var(--text-secondary);
|
||||
@@ -312,8 +356,8 @@
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
outline: none;
|
||||
transition: height 0.35s ease, border-color 0.35s ease;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* ── Collapsed state: thumbnail tile ────────── */
|
||||
@@ -395,19 +439,30 @@
|
||||
|
||||
/* ── Expanded state: wrapper becomes scroll panel ── */
|
||||
|
||||
/* Disable root-level overscroll (rubberbanding) while a PDF is open. */
|
||||
body.pdf-viewer-open {
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
.pdf-expanded {
|
||||
/* Fill viewport minus the column's vertical padding */
|
||||
max-height: calc(100vh - var(--space-xl) * 2);
|
||||
height: clamp(400px, 80vh, calc(100vh - var(--space-xl) * 2));
|
||||
/* Fill the right column from top to bottom (under the header). */
|
||||
height: 100%;
|
||||
min-height: 400px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
overscroll-behavior-y: contain;
|
||||
border: 2px solid var(--accent-primary);
|
||||
display: block;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: color-mix(in srgb, var(--accent-secondary) 22%, transparent);
|
||||
}
|
||||
|
||||
/* ── Toolbar ────────────────────────────────── */
|
||||
|
||||
.pdf-toolbar {
|
||||
position: sticky;
|
||||
align-self: stretch;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
@@ -420,6 +475,7 @@
|
||||
flex-shrink: 0;
|
||||
font-size: var(--step--1);
|
||||
user-select: none;
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
.pdf-toolbar-btn {
|
||||
@@ -505,6 +561,19 @@
|
||||
.tfe-title {
|
||||
font-size: var(--step-2);
|
||||
}
|
||||
|
||||
/* PDF expands to full viewport height on mobile, above everything */
|
||||
.pdf-expanded {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
height: auto;
|
||||
min-height: unset;
|
||||
background: color-mix(in srgb, var(--accent-secondary) 92%, #000 8%);
|
||||
}
|
||||
.tfe-file-iframe {
|
||||
height: 100dvh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
|
||||
Reference in New Issue
Block a user