New content element option "Vollbild-Schaltfläche anzeigen" (on by default). The button only appears once the browser confirms it exposes the Fullscreen API for ordinary elements -- iOS Safari offers it for video only, so there it stays hidden rather than presenting a control that cannot work. Fitting the book to the screen needed the layout to become height-aware. Page size was derived from width alone, which at screen width puts an A4-proportioned page well below the bottom of the viewport. In fullscreen the page now fits to the available height and the narrower book is centred; pages re-render at the new size through the existing generation-stamped path. The height fit writes a max-width onto the stage, so in fullscreen the available width is measured on the parent instead -- measuring the element we just constrained would oscillate. Verified stable across repeated samples. The resize handler body moved into relayout(), shared with the fullscreen toggle. destroy() leaves fullscreen first so the browser is not left holding a node that is about to go away. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
182 lines
4.1 KiB
CSS
182 lines
4.1 KiB
CSS
.mod-pdf-flipbook {
|
|
--flipbook-bg: #e0e0e0;
|
|
--flipbook-text: #302d29;
|
|
--flipbook-accent: #6f4f28;
|
|
position: relative;
|
|
padding: 3rem;
|
|
background: var(--flipbook-bg);
|
|
}
|
|
|
|
.mod-pdf-flipbook:focus-visible {
|
|
outline: 2px solid var(--flipbook-accent);
|
|
outline-offset: 3px;
|
|
}
|
|
|
|
.mod-pdf-flipbook__status {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.55rem;
|
|
margin-bottom: 0.8rem;
|
|
font-size: 0.92rem;
|
|
color: var(--flipbook-text);
|
|
}
|
|
|
|
.mod-pdf-flipbook__status::before {
|
|
content: '';
|
|
width: 0.9rem;
|
|
height: 0.9rem;
|
|
border: 2px solid rgba(48, 45, 41, 0.25);
|
|
border-top-color: rgba(48, 45, 41, 0.85);
|
|
border-radius: 50%;
|
|
animation: mod-pdf-flipbook-spin 0.75s linear infinite;
|
|
}
|
|
|
|
.mod-pdf-flipbook__status.is-hidden {
|
|
display: none;
|
|
}
|
|
|
|
.mod-pdf-flipbook__status.is-error {
|
|
color: #9f1f1f;
|
|
}
|
|
|
|
.mod-pdf-flipbook__status.is-error::before {
|
|
display: none;
|
|
}
|
|
|
|
.mod-pdf-flipbook__stage {
|
|
position: relative;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
background: #e0e0e0;
|
|
z-index: 1;
|
|
transition: opacity 1.3s ease 0.5s;
|
|
}
|
|
|
|
.mod-pdf-flipbook .c-flipbook {
|
|
max-width: 100%;
|
|
}
|
|
|
|
.mod-pdf-flipbook .c-flipbook.is-booting,
|
|
.mod-pdf-flipbook .c-flipbook.is-booting .c-flipbook__page,
|
|
.mod-pdf-flipbook .c-flipbook.is-booting .c-flipbook__page::before {
|
|
transition: none !important;
|
|
}
|
|
|
|
.mod-pdf-flipbook .c-flipbook__page {
|
|
background: #fefdf9;
|
|
overflow: hidden;
|
|
border: 1px solid #e2dbcc;
|
|
}
|
|
|
|
.mod-pdf-flipbook .c-flipbook__page canvas {
|
|
display: block;
|
|
width: 100%;
|
|
height: 100%;
|
|
/* Pages that deviate from the document's dominant format are letterboxed
|
|
inside the uniform page box instead of being stretched to fit it. */
|
|
object-fit: contain;
|
|
}
|
|
|
|
.mod-pdf-flipbook__page-loader {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.85rem;
|
|
color: #6f675a;
|
|
background: repeating-linear-gradient(
|
|
-45deg,
|
|
rgba(184, 176, 160, 0.18),
|
|
rgba(184, 176, 160, 0.18) 14px,
|
|
rgba(239, 235, 227, 0.28) 14px,
|
|
rgba(239, 235, 227, 0.28) 28px
|
|
);
|
|
}
|
|
|
|
/* Set while a canvas is mounted. Evicted pages show the placeholder again
|
|
rather than a blank page. */
|
|
.mod-pdf-flipbook__page-loader.is-hidden {
|
|
display: none;
|
|
}
|
|
|
|
.mod-pdf-flipbook__controls {
|
|
position: relative;
|
|
z-index: 20;
|
|
display: flex;
|
|
gap: 0.6rem;
|
|
margin-top: 0.9rem;
|
|
transition: opacity 1.3s ease 0.5s;
|
|
}
|
|
|
|
.mod-pdf-flipbook__error {
|
|
margin-top: 0.8rem;
|
|
color: #9f1f1f;
|
|
}
|
|
|
|
/* Set by the module once the browser confirms the Fullscreen API is usable. */
|
|
.mod-pdf-flipbook.is-fullscreen {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.5rem;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
padding: 1.5rem;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.mod-pdf-flipbook.is-fullscreen .mod-pdf-flipbook__stage {
|
|
width: 100%;
|
|
margin: 0;
|
|
}
|
|
|
|
.mod-pdf-flipbook.is-fullscreen .mod-pdf-flipbook__status {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
/* The equivalent alternative stays on the page itself; repeating it inside the
|
|
viewer would only eat height the book can use. */
|
|
.mod-pdf-flipbook.is-fullscreen .mod-pdf-flipbook__download {
|
|
display: none;
|
|
}
|
|
|
|
/* Text in a canvas is invisible to assistive technology and cannot be selected
|
|
or searched, so the original file stays reachable as an equivalent
|
|
alternative. */
|
|
.mod-pdf-flipbook__download {
|
|
display: inline-block;
|
|
margin-top: 0.9rem;
|
|
font-size: 0.92rem;
|
|
color: var(--flipbook-text);
|
|
}
|
|
|
|
@media (max-width: 767px) {
|
|
.mod-pdf-flipbook__controls {
|
|
justify-content: space-between;
|
|
}
|
|
}
|
|
|
|
@keyframes mod-pdf-flipbook-spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.mod-pdf-flipbook__status::before {
|
|
animation: none;
|
|
}
|
|
|
|
.mod-pdf-flipbook__stage,
|
|
.mod-pdf-flipbook__controls {
|
|
transition: none;
|
|
}
|
|
|
|
.mod-pdf-flipbook .c-flipbook__page,
|
|
.mod-pdf-flipbook .c-flipbook__page::before {
|
|
transition-duration: 1ms !important;
|
|
}
|
|
}
|