fix(reader): web reader safe areas, status bar colour and fullscreen handling (#2856)
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Grimmory",
|
"name": "Grimmory",
|
||||||
"short_name": "Grimmory",
|
"short_name": "Grimmory",
|
||||||
"display": "fullscreen",
|
"display": "standalone",
|
||||||
"display_override": ["fullscreen", "standalone", "browser"],
|
|
||||||
"scope": "./",
|
"scope": "./",
|
||||||
"start_url": "./",
|
"start_url": "./",
|
||||||
"background_color": "#0d1012",
|
"background_color": "#0d1012",
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<div #readerRoot class="comic-reader-container" tabindex="0"
|
<div class="comic-reader-container" tabindex="0"
|
||||||
[class.rtl-reading]="readingDirection() === CbxReadingDirection.RTL"
|
[class.rtl-reading]="readingDirection() === CbxReadingDirection.RTL"
|
||||||
[class.fullscreen-mode]="isFullscreen()" [class.slideshow-active]="isSlideshowActive()">
|
[class.fullscreen-mode]="isFullscreen()" [class.slideshow-active]="isSlideshowActive()">
|
||||||
|
@for (color of [topBarColor()]; track color) {
|
||||||
|
<div class="browser-bar top-0" [style.background]="color" aria-hidden="true"></div>
|
||||||
|
}
|
||||||
|
@for (color of [bottomBarColor()]; track color) {
|
||||||
|
<div class="browser-bar bottom-0" [style.background]="color" aria-hidden="true"></div>
|
||||||
|
}
|
||||||
|
|
||||||
<app-cbx-header [isCurrentPageBookmarked]="isCurrentPageBookmarked()"
|
<app-cbx-header [isCurrentPageBookmarked]="isCurrentPageBookmarked()"
|
||||||
[currentPageHasNotes]="currentPageHasNotes()"
|
[currentPageHasNotes]="currentPageHasNotes()"
|
||||||
(hoverChange)="onHeaderHovered($event)"></app-cbx-header>
|
(hoverChange)="onHeaderHovered($event)"></app-cbx-header>
|
||||||
@@ -58,9 +65,8 @@
|
|||||||
[class.long-strip]="scrollMode() === CbxScrollMode.LONG_STRIP"
|
[class.long-strip]="scrollMode() === CbxScrollMode.LONG_STRIP"
|
||||||
[class.fit-actual-size]="fitMode() === CbxFitMode.ACTUAL_SIZE" [class.fit-page]="fitMode() === CbxFitMode.FIT_PAGE"
|
[class.fit-actual-size]="fitMode() === CbxFitMode.ACTUAL_SIZE" [class.fit-page]="fitMode() === CbxFitMode.FIT_PAGE"
|
||||||
[class.fit-width]="fitMode() === CbxFitMode.FIT_WIDTH" [class.fit-height]="fitMode() === CbxFitMode.FIT_HEIGHT"
|
[class.fit-width]="fitMode() === CbxFitMode.FIT_WIDTH" [class.fit-height]="fitMode() === CbxFitMode.FIT_HEIGHT"
|
||||||
[class.fit-auto]="fitMode() === CbxFitMode.AUTO" [class.bg-black]="backgroundColor() === CbxBackgroundColor.BLACK"
|
[class.fit-auto]="fitMode() === CbxFitMode.AUTO" [style.background-color]="pageColor()"
|
||||||
[class.bg-gray]="backgroundColor() === CbxBackgroundColor.GRAY"
|
[class.emulate-book]="emulateBook() && isTwoPageView()"
|
||||||
[class.bg-white]="backgroundColor() === CbxBackgroundColor.WHITE" [class.emulate-book]="emulateBook() && isTwoPageView()"
|
|
||||||
[style.filter]="brightness() < 100 ? 'brightness(' + brightness() + '%)' : null" (scroll)="onScroll($event)">
|
[style.filter]="brightness() < 100 ? 'brightness(' + brightness() + '%)' : null" (scroll)="onScroll($event)">
|
||||||
@if (!isLoading()) {
|
@if (!isLoading()) {
|
||||||
@if (pages().length > 0) {
|
@if (pages().length > 0) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@use '../shared/styles/reader-chrome' as *;
|
||||||
|
|
||||||
@mixin cbx-reader-continuation-affordance {
|
@mixin cbx-reader-continuation-affordance {
|
||||||
.cbx-continuation-spacer {
|
.cbx-continuation-spacer {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
@@ -26,15 +28,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.comic-reader-container {
|
.comic-reader-container {
|
||||||
|
@include safe-area;
|
||||||
|
|
||||||
|
--reader-header-height: calc(38px + var(--safe-edge-top));
|
||||||
|
--reader-footer-height: calc(52px + var(--safe-edge-bottom));
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100dvh;
|
position: fixed;
|
||||||
width: 100vw;
|
inset: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: #1a1a1a;
|
background: #1a1a1a;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
position: relative;
|
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@@ -43,12 +49,6 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:fullscreen {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.webtoon-suggestion-banner {
|
.webtoon-suggestion-banner {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.6563rem 0.875rem;
|
gap: 0.6563rem 0.875rem;
|
||||||
padding: 0.5687rem 0.875rem;
|
padding: 0.5687rem 0.875rem;
|
||||||
margin: 0 0.4375rem;
|
margin: var(--safe-edge-top) calc(0.4375rem + var(--safe-edge-right)) 0 calc(0.4375rem + var(--safe-edge-left));
|
||||||
background: rgb(30 40 55 / 95%);
|
background: rgb(30 40 55 / 95%);
|
||||||
border: 1px solid rgb(255 255 255 / 12%);
|
border: 1px solid rgb(255 255 255 / 12%);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
// Slideshow progress bar
|
// Slideshow progress bar
|
||||||
.slideshow-progress {
|
.slideshow-progress {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: var(--safe-edge-bottom);
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 3px;
|
height: 3px;
|
||||||
background: #4a90e2;
|
background: #4a90e2;
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
transition: bottom 0.3s ease;
|
transition: bottom 0.3s ease;
|
||||||
|
|
||||||
&.above-footer {
|
&.above-footer {
|
||||||
bottom: 52px;
|
bottom: var(--reader-footer-height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@
|
|||||||
|
|
||||||
.bookmark-indicator {
|
.bookmark-indicator {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: var(--safe-edge-top);
|
||||||
right: 24px;
|
right: calc(24px + var(--safe-edge-right));
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
filter: drop-shadow(0 2px 4px rgb(0 0 0 / 30%));
|
filter: drop-shadow(0 2px 4px rgb(0 0 0 / 30%));
|
||||||
@@ -180,14 +180,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.image-container {
|
.image-container {
|
||||||
|
container-type: size;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 0.4375rem;
|
padding: calc(0.4375rem + var(--safe-edge-top)) calc(0.4375rem + var(--safe-edge-right))
|
||||||
background: #0f0f0f;
|
calc(0.4375rem + var(--safe-edge-bottom)) calc(0.4375rem + var(--safe-edge-left));
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|
||||||
&:not(.two-page-view, .infinite-scroll) {
|
&:not(.two-page-view, .infinite-scroll) {
|
||||||
@@ -212,18 +213,6 @@
|
|||||||
cursor: none;
|
cursor: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.bg-black {
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.bg-gray {
|
|
||||||
background: #0f0f0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.bg-white {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(.infinite-scroll) {
|
&:not(.infinite-scroll) {
|
||||||
.pages-wrapper {
|
.pages-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -341,7 +330,7 @@
|
|||||||
|
|
||||||
.page-image {
|
.page-image {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: calc(100dvh - 0.875rem);
|
height: 100cqh;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +350,7 @@
|
|||||||
|
|
||||||
.page-image {
|
.page-image {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: calc(100dvh - 0.875rem);
|
height: 100cqh;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,6 +461,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.infinite-scroll {
|
&.infinite-scroll {
|
||||||
|
--page-gap: 0.875rem;
|
||||||
|
|
||||||
overflow: hidden auto;
|
overflow: hidden auto;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
touch-action: pan-y;
|
touch-action: pan-y;
|
||||||
@@ -481,10 +472,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.875rem;
|
gap: var(--page-gap);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
padding: 0.875rem 0;
|
padding: var(--page-gap) 0;
|
||||||
overflow-anchor: none;
|
overflow-anchor: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,7 +520,7 @@
|
|||||||
|
|
||||||
.page-image {
|
.page-image {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: calc(100vh - 1.75rem);
|
height: calc(100cqh - var(--page-gap));
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,7 +549,7 @@
|
|||||||
|
|
||||||
.page-image {
|
.page-image {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: calc(100vh - 1.75rem);
|
max-height: calc(100cqh - var(--page-gap));
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
@@ -571,7 +562,7 @@
|
|||||||
|
|
||||||
.page-image {
|
.page-image {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: calc(100vh - 1.75rem);
|
max-height: calc(100cqh - var(--page-gap));
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
@@ -643,7 +634,7 @@
|
|||||||
|
|
||||||
.long-strip-image {
|
.long-strip-image {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: calc(100vh - 1.75rem);
|
height: 100cqh;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -671,7 +662,7 @@
|
|||||||
|
|
||||||
.long-strip-image {
|
.long-strip-image {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: calc(100vh - 1.75rem);
|
max-height: 100cqh;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
@@ -684,7 +675,7 @@
|
|||||||
|
|
||||||
.long-strip-image {
|
.long-strip-image {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: calc(100vh - 1.75rem);
|
max-height: 100cqh;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
@@ -773,11 +764,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.browser-bar {
|
||||||
|
@include browser-bar;
|
||||||
|
}
|
||||||
|
|
||||||
@media (width <=768px) {
|
@media (width <=768px) {
|
||||||
.comic-reader-container {
|
.comic-reader-container {
|
||||||
.slideshow-progress.above-footer {
|
--reader-footer-height: calc(48px + var(--safe-edge-bottom));
|
||||||
bottom: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image-container {
|
.image-container {
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import {
|
|||||||
writeStripWidthPercentPerBook
|
writeStripWidthPercentPerBook
|
||||||
} from './core/cbx-reader-storage';
|
} from './core/cbx-reader-storage';
|
||||||
import {computeCbxSpreads, findCbxSpreadForPage} from './core/cbx-spread.util';
|
import {computeCbxSpreads, findCbxSpreadForPage} from './core/cbx-spread.util';
|
||||||
|
import {isTouchScreen, setupReaderEdges} from '../shared/reader-edges.util';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-cbx-reader',
|
selector: 'app-cbx-reader',
|
||||||
@@ -159,7 +159,6 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
|||||||
// Magnifier
|
// Magnifier
|
||||||
isMagnifierActive = signal(false);
|
isMagnifierActive = signal(false);
|
||||||
private magnifierLensRef = viewChild<ElementRef<HTMLDivElement>>('magnifierLens');
|
private magnifierLensRef = viewChild<ElementRef<HTMLDivElement>>('magnifierLens');
|
||||||
private readerRootRef = viewChild<ElementRef<HTMLElement>>('readerRoot');
|
|
||||||
private imageScrollHostRef = viewChild<ElementRef<HTMLElement>>('imageScrollHost');
|
private imageScrollHostRef = viewChild<ElementRef<HTMLElement>>('imageScrollHost');
|
||||||
magnifierZoom = signal<CbxMagnifierZoom>(CbxMagnifierZoom.ZOOM_3X);
|
magnifierZoom = signal<CbxMagnifierZoom>(CbxMagnifierZoom.ZOOM_3X);
|
||||||
magnifierLensSize = signal<CbxMagnifierLensSize>(CbxMagnifierLensSize.MEDIUM);
|
magnifierLensSize = signal<CbxMagnifierLensSize>(CbxMagnifierLensSize.MEDIUM);
|
||||||
@@ -248,6 +247,22 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
isFooterVisible = computed(() => this.footerService.forceVisible());
|
isFooterVisible = computed(() => this.footerService.forceVisible());
|
||||||
|
|
||||||
|
private static readonly PAGE_COLORS: Record<CbxBackgroundColor, string> = {
|
||||||
|
[CbxBackgroundColor.BLACK]: '#000',
|
||||||
|
[CbxBackgroundColor.GRAY]: '#0f0f0f',
|
||||||
|
[CbxBackgroundColor.WHITE]: '#fff',
|
||||||
|
};
|
||||||
|
|
||||||
|
pageColor = computed(() => CbxReaderComponent.PAGE_COLORS[this.backgroundColor()]);
|
||||||
|
|
||||||
|
stripColor = computed(() => this.brightness() < 100
|
||||||
|
? `color-mix(in srgb, ${this.pageColor()} ${this.brightness()}%, black)`
|
||||||
|
: this.pageColor());
|
||||||
|
|
||||||
|
topBarColor = computed(() => this.headerService.forceVisible() ? 'var(--reader-chrome-bg)' : this.stripColor());
|
||||||
|
|
||||||
|
bottomBarColor = computed(() => this.isFooterVisible() ? 'var(--reader-chrome-bg)' : this.stripColor());
|
||||||
|
|
||||||
showQuickSettings = computed(() => this.quickSettingsService.visible());
|
showQuickSettings = computed(() => this.quickSettingsService.visible());
|
||||||
|
|
||||||
isAtLastPage = computed(() => this.currentPage() >= this.pages().length - 1);
|
isAtLastPage = computed(() => this.currentPage() >= this.pages().length - 1);
|
||||||
@@ -285,6 +300,8 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
setupReaderEdges(this.stripColor);
|
||||||
|
|
||||||
effect(() => {
|
effect(() => {
|
||||||
this.sidebarService.bookmarks();
|
this.sidebarService.bookmarks();
|
||||||
this.updateBookmarkState();
|
this.updateBookmarkState();
|
||||||
@@ -297,7 +314,7 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.visibilityManager = new ReaderHeaderFooterVisibilityManager(window.innerHeight);
|
this.visibilityManager = new ReaderHeaderFooterVisibilityManager(window.innerHeight, !isTouchScreen());
|
||||||
this.visibilityManager.onStateChange((state) => {
|
this.visibilityManager.onStateChange((state) => {
|
||||||
this.headerService.setForceVisible(state.headerVisible);
|
this.headerService.setForceVisible(state.headerVisible);
|
||||||
this.footerService.setForceVisible(state.footerVisible);
|
this.footerService.setForceVisible(state.footerVisible);
|
||||||
@@ -1811,8 +1828,7 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
@HostListener('document:fullscreenchange')
|
@HostListener('document:fullscreenchange')
|
||||||
onFullscreenChange(): void {
|
onFullscreenChange(): void {
|
||||||
const target = this.readerRootRef()?.nativeElement ?? document.documentElement;
|
this.isFullscreen.set(!!document.fullscreenElement);
|
||||||
this.isFullscreen.set(document.fullscreenElement === target);
|
|
||||||
this.headerService.updateState({ isFullscreen: this.isFullscreen(), isSlideshowActive: this.isSlideshowActive() });
|
this.headerService.updateState({ isFullscreen: this.isFullscreen(), isSlideshowActive: this.isSlideshowActive() });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1995,7 +2011,7 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enterFullscreen(): void {
|
private enterFullscreen(): void {
|
||||||
const elem = this.readerRootRef()?.nativeElement ?? document.documentElement;
|
const elem = document.documentElement;
|
||||||
if (elem.requestFullscreen) {
|
if (elem.requestFullscreen) {
|
||||||
void elem.requestFullscreen().catch(() => undefined);
|
void elem.requestFullscreen().catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -7,8 +7,8 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 52px;
|
height: var(--reader-footer-height);
|
||||||
padding: 0 16px;
|
padding: 0 calc(16px + var(--safe-edge-right)) var(--safe-edge-bottom) calc(16px + var(--safe-edge-left));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -295,8 +295,7 @@
|
|||||||
|
|
||||||
@media (width <= 768px) {
|
@media (width <= 768px) {
|
||||||
.cbx-footer {
|
.cbx-footer {
|
||||||
height: 48px;
|
padding: 0 calc(8px + var(--safe-edge-right)) var(--safe-edge-bottom) calc(8px + var(--safe-edge-left));
|
||||||
padding: 0 8px;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-9
@@ -7,8 +7,8 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 38px;
|
height: var(--reader-header-height);
|
||||||
padding: 0 12px;
|
padding: var(--safe-edge-top) calc(12px + var(--safe-edge-right)) 0 calc(12px + var(--safe-edge-left));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
.header-right {
|
.header-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +46,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-right: 8px;
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
@@ -56,10 +56,6 @@
|
|||||||
background: var(--reader-chrome-hover);
|
background: var(--reader-chrome-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.close-btn {
|
&.close-btn {
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
@@ -164,11 +160,15 @@
|
|||||||
|
|
||||||
@media (width <= 600px) {
|
@media (width <= 600px) {
|
||||||
.cbx-header {
|
.cbx-header {
|
||||||
padding: 0 4px;
|
padding: var(--safe-edge-top) calc(4px + var(--safe-edge-right)) 0 calc(4px + var(--safe-edge-left));
|
||||||
|
|
||||||
|
.header-left,
|
||||||
|
.header-right {
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-btn {
|
.icon-btn {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin-right: 6px;
|
|
||||||
|
|
||||||
app-reader-icon {
|
app-reader-icon {
|
||||||
transform: scale(0.9);
|
transform: scale(0.9);
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ describe('CbxHeaderService', () => {
|
|||||||
service.reset();
|
service.reset();
|
||||||
|
|
||||||
expect(service.bookTitle()).toBe('');
|
expect(service.bookTitle()).toBe('');
|
||||||
expect(service.forceVisible()).toBe(true);
|
expect(service.forceVisible()).toBe(false);
|
||||||
expect(service.state()).toEqual({
|
expect(service.state()).toEqual({
|
||||||
isFullscreen: false,
|
isFullscreen: false,
|
||||||
isSlideshowActive: false,
|
isSlideshowActive: false,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class CbxHeaderService {
|
|||||||
private readonly _bookTitle = signal('');
|
private readonly _bookTitle = signal('');
|
||||||
readonly bookTitle = this._bookTitle.asReadonly();
|
readonly bookTitle = this._bookTitle.asReadonly();
|
||||||
|
|
||||||
private readonly _forceVisible = signal(true);
|
private readonly _forceVisible = signal(false);
|
||||||
readonly forceVisible = this._forceVisible.asReadonly();
|
readonly forceVisible = this._forceVisible.asReadonly();
|
||||||
|
|
||||||
private readonly _state = signal<CbxHeaderState>(this.defaultState);
|
private readonly _state = signal<CbxHeaderState>(this.defaultState);
|
||||||
@@ -99,7 +99,7 @@ export class CbxHeaderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset(): void {
|
reset(): void {
|
||||||
this._forceVisible.set(true);
|
this._forceVisible.set(false);
|
||||||
this._state.set(this.defaultState);
|
this._state.set(this.defaultState);
|
||||||
this._bookTitle.set('');
|
this._bookTitle.set('');
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-5
@@ -17,10 +17,15 @@
|
|||||||
.quick-settings-panel {
|
.quick-settings-panel {
|
||||||
@include surface;
|
@include surface;
|
||||||
|
|
||||||
|
--quick-settings-top: calc(var(--reader-header-height) + 16px);
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 52px;
|
top: var(--quick-settings-top);
|
||||||
right: 60px;
|
right: calc(60px + var(--safe-edge-right));
|
||||||
width: 340px;
|
width: 340px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-height: calc(100dvh - var(--quick-settings-top) - var(--safe-edge-panel-bottom));
|
||||||
border: 1px solid var(--reader-chrome-border);
|
border: 1px solid var(--reader-chrome-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
box-shadow: 0 12px 40px rgb(0 0 0 / 50%);
|
box-shadow: 0 12px 40px rgb(0 0 0 / 50%);
|
||||||
@@ -57,6 +62,9 @@
|
|||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control {
|
.control {
|
||||||
@@ -207,10 +215,9 @@
|
|||||||
|
|
||||||
@media (width <= 600px) {
|
@media (width <= 600px) {
|
||||||
.quick-settings-panel {
|
.quick-settings-panel {
|
||||||
right: 16px;
|
right: calc(16px + var(--safe-edge-right));
|
||||||
left: 16px;
|
left: calc(16px + var(--safe-edge-left));
|
||||||
width: auto;
|
width: auto;
|
||||||
top: 56px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pointer {
|
.pointer {
|
||||||
|
|||||||
+1
-1
@@ -19,12 +19,12 @@ $sidebar-width: 300px;
|
|||||||
// Sidebar container
|
// Sidebar container
|
||||||
.sidebar {
|
.sidebar {
|
||||||
@include surface;
|
@include surface;
|
||||||
|
@include sidebar-edge(left, $sidebar-width);
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: $sidebar-width;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-shadow: 4px 0 24px rgb(0 0 0 / 30%);
|
box-shadow: 4px 0 24px rgb(0 0 0 / 30%);
|
||||||
|
|||||||
@@ -3,6 +3,13 @@
|
|||||||
[class.immersive]="immersiveMode()"
|
[class.immersive]="immersiveMode()"
|
||||||
[style.background-color]="readerState().theme.bg ?? ''">
|
[style.background-color]="readerState().theme.bg ?? ''">
|
||||||
|
|
||||||
|
@for (color of [readerState().theme.bg]; track color) {
|
||||||
|
<div class="browser-bar top-0" [style.background]="color" aria-hidden="true"></div>
|
||||||
|
}
|
||||||
|
@for (color of [forceNavbarVisible() ? 'var(--reader-chrome-bg)' : readerState().theme.bg]; track color) {
|
||||||
|
<div class="browser-bar bottom-0" [style.background]="color" aria-hidden="true"></div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="header-trigger-zone"
|
<div class="header-trigger-zone"
|
||||||
[class.inactive]="headerVisible() || immersiveMode()"
|
[class.inactive]="headerVisible() || immersiveMode()"
|
||||||
(mouseenter)="onHeaderTriggerZoneEnter()"></div>
|
(mouseenter)="onHeaderTriggerZoneEnter()"></div>
|
||||||
|
|||||||
@@ -1,14 +1,25 @@
|
|||||||
|
@use '../shared/styles/reader-chrome' as *;
|
||||||
|
|
||||||
.reader {
|
.reader {
|
||||||
width: 100vw;
|
@include safe-area;
|
||||||
height: 100dvh;
|
|
||||||
|
--reader-header-height: calc(36px + var(--safe-edge-top));
|
||||||
|
--reader-footer-height: calc(48px + var(--safe-edge-bottom));
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
inset: 0;
|
||||||
left: 0;
|
padding: var(--safe-edge-top) var(--safe-edge-right) var(--safe-edge-bottom) var(--safe-edge-left);
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
--reader-footer-height: calc(44px + var(--safe-edge-bottom));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.browser-bar {
|
||||||
|
@include browser-bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-trigger-zone {
|
.header-trigger-zone {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import {RelocateProgressData} from './state/progress.service';
|
|||||||
import {WakeLockService} from '../../../shared/service/wake-lock.service';
|
import {WakeLockService} from '../../../shared/service/wake-lock.service';
|
||||||
import {ViewEvent} from './core/view-manager.service';
|
import {ViewEvent} from './core/view-manager.service';
|
||||||
import {PageTitleService} from '../../../shared/service/page-title.service';
|
import {PageTitleService} from '../../../shared/service/page-title.service';
|
||||||
|
import {isTouchScreen, setupReaderEdges} from '../shared/reader-edges.util';
|
||||||
|
|
||||||
interface PendingInitialChapterRestore {
|
interface PendingInitialChapterRestore {
|
||||||
href: string;
|
href: string;
|
||||||
@@ -133,6 +134,7 @@ export class EbookReaderComponent implements OnInit {
|
|||||||
protected progressData = signal<RelocateProgressData | null>(null);
|
protected progressData = signal<RelocateProgressData | null>(null);
|
||||||
|
|
||||||
readonly readerState = this.stateService.state;
|
readonly readerState = this.stateService.state;
|
||||||
|
private readonly requestAutoFullscreen = setupReaderEdges(() => this.readerState().theme.bg ?? '');
|
||||||
readonly selectionState = this.selectionService.state;
|
readonly selectionState = this.selectionService.state;
|
||||||
readonly noteDialogState = this.noteService.dialogState;
|
readonly noteDialogState = this.noteService.dialogState;
|
||||||
readonly isCurrentCfiBookmarked = this.headerService.isCurrentCfiBookmarked;
|
readonly isCurrentCfiBookmarked = this.headerService.isCurrentCfiBookmarked;
|
||||||
@@ -174,7 +176,7 @@ export class EbookReaderComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.visibilityManager = new ReaderHeaderFooterVisibilityManager(window.innerHeight);
|
this.visibilityManager = new ReaderHeaderFooterVisibilityManager(window.innerHeight, !isTouchScreen());
|
||||||
this.visibilityManager.onStateChange((state) => {
|
this.visibilityManager.onStateChange((state) => {
|
||||||
this.headerVisible.set(state.headerVisible);
|
this.headerVisible.set(state.headerVisible);
|
||||||
this.headerService.setForceVisible(state.headerVisible);
|
this.headerService.setForceVisible(state.headerVisible);
|
||||||
@@ -317,6 +319,7 @@ export class EbookReaderComponent implements OnInit {
|
|||||||
this.updateSectionFractions();
|
this.updateSectionFractions();
|
||||||
break;
|
break;
|
||||||
case 'relocate':
|
case 'relocate':
|
||||||
|
this.requestAutoFullscreen();
|
||||||
if (this.handlePendingInitialChapterRestore(event.detail)) {
|
if (this.handlePendingInitialChapterRestore(event.detail)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -332,6 +335,7 @@ export class EbookReaderComponent implements OnInit {
|
|||||||
}, 500);
|
}, 500);
|
||||||
break;
|
break;
|
||||||
case 'middle-single-tap':
|
case 'middle-single-tap':
|
||||||
|
this.requestAutoFullscreen();
|
||||||
if (this.immersiveMode()) {
|
if (this.immersiveMode()) {
|
||||||
this.immersiveTemporaryShow();
|
this.immersiveTemporaryShow();
|
||||||
} else {
|
} else {
|
||||||
@@ -575,6 +579,7 @@ export class EbookReaderComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('document:mousemove', ['$event'])
|
@HostListener('document:mousemove', ['$event'])
|
||||||
|
@HostListener('document:mouseover', ['$event'])
|
||||||
onMouseMove(event: MouseEvent): void {
|
onMouseMove(event: MouseEvent): void {
|
||||||
this.visibilityManager.handleMouseMove(event.clientY);
|
this.visibilityManager.handleMouseMove(event.clientY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 48px;
|
height: var(--reader-footer-height);
|
||||||
padding: 0 12px;
|
padding: 0 calc(12px + var(--safe-edge-right)) var(--safe-edge-bottom) calc(12px + var(--safe-edge-left));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
@include text;
|
@include text;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 60px;
|
bottom: calc(var(--reader-footer-height) + 12px);
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
background: var(--reader-chrome-bg);
|
background: var(--reader-chrome-bg);
|
||||||
@@ -413,8 +413,7 @@
|
|||||||
|
|
||||||
@media (width <= 600px) {
|
@media (width <= 600px) {
|
||||||
.reader-navbar {
|
.reader-navbar {
|
||||||
padding: 0 8px;
|
padding: 0 calc(8px + var(--safe-edge-right)) var(--safe-edge-bottom) calc(8px + var(--safe-edge-left));
|
||||||
height: 44px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.location-popover {
|
.location-popover {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 36px;
|
height: var(--reader-header-height);
|
||||||
padding: 0 10px;
|
padding: var(--safe-edge-top) calc(10px + var(--safe-edge-right)) 0 calc(10px + var(--safe-edge-left));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
.header-right {
|
.header-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,17 +43,12 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-right: 4px;
|
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
color: #ef4444;
|
color: #ef4444;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@@ -128,11 +124,15 @@
|
|||||||
|
|
||||||
@media (width <= 600px) {
|
@media (width <= 600px) {
|
||||||
.reader-header {
|
.reader-header {
|
||||||
padding: 0 2px;
|
padding: var(--safe-edge-top) calc(2px + var(--safe-edge-right)) 0 calc(2px + var(--safe-edge-left));
|
||||||
|
|
||||||
|
.header-left,
|
||||||
|
.header-right {
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-btn {
|
.icon-btn {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin-right: 2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.desktop-only {
|
.desktop-only {
|
||||||
|
|||||||
+10
-2
@@ -17,10 +17,15 @@
|
|||||||
.quick-settings-panel {
|
.quick-settings-panel {
|
||||||
@include surface;
|
@include surface;
|
||||||
|
|
||||||
|
--quick-settings-top: calc(var(--reader-header-height) + 16px);
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 52px;
|
top: var(--quick-settings-top);
|
||||||
right: 60px;
|
right: calc(60px + var(--safe-edge-right));
|
||||||
width: 280px;
|
width: 280px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-height: calc(100dvh - var(--quick-settings-top) - var(--safe-edge-panel-bottom));
|
||||||
border: 1px solid var(--reader-chrome-border);
|
border: 1px solid var(--reader-chrome-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
box-shadow: 0 12px 40px rgb(0 0 0 / 50%);
|
box-shadow: 0 12px 40px rgb(0 0 0 / 50%);
|
||||||
@@ -57,6 +62,9 @@
|
|||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control {
|
.control {
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ $sidebar-width: 320px;
|
|||||||
// Sidebar container - positioned on the RIGHT
|
// Sidebar container - positioned on the RIGHT
|
||||||
.sidebar {
|
.sidebar {
|
||||||
@include surface;
|
@include surface;
|
||||||
|
@include sidebar-edge(right, $sidebar-width);
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: $sidebar-width;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-shadow: -4px 0 24px rgb(0 0 0 / 30%);
|
box-shadow: -4px 0 24px rgb(0 0 0 / 30%);
|
||||||
|
|||||||
+1
-1
@@ -19,12 +19,12 @@ $sidebar-width: 300px;
|
|||||||
// Sidebar container
|
// Sidebar container
|
||||||
.sidebar {
|
.sidebar {
|
||||||
@include surface;
|
@include surface;
|
||||||
|
@include sidebar-edge(left, $sidebar-width);
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: $sidebar-width;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-shadow: 4px 0 24px rgb(0 0 0 / 30%);
|
box-shadow: 4px 0 24px rgb(0 0 0 / 30%);
|
||||||
|
|||||||
@@ -89,4 +89,38 @@ describe('ReaderHeaderFooterVisibilityManager', () => {
|
|||||||
|
|
||||||
expect(manager.getVisibilityState()).toEqual({headerVisible: false, footerVisible: true});
|
expect(manager.getVisibilityState()).toEqual({headerVisible: false, footerVisible: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has no pointer position until the mouse moves, and forgets it when the mouse leaves', () => {
|
||||||
|
const manager = new ReaderHeaderFooterVisibilityManager(852);
|
||||||
|
|
||||||
|
manager.updateWindowHeight(393);
|
||||||
|
manager.togglePinned();
|
||||||
|
manager.togglePinned();
|
||||||
|
expect(manager.getVisibilityState()).toEqual({headerVisible: false, footerVisible: false});
|
||||||
|
|
||||||
|
manager.handleMouseMove(380);
|
||||||
|
manager.handleMouseLeave();
|
||||||
|
manager.togglePinned();
|
||||||
|
manager.togglePinned();
|
||||||
|
expect(manager.getVisibilityState()).toEqual({headerVisible: false, footerVisible: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('on touch screens shows and hides both bars together on taps, whatever the pointer did', () => {
|
||||||
|
const manager = new ReaderHeaderFooterVisibilityManager(924, false);
|
||||||
|
|
||||||
|
manager.handleMouseMove(900);
|
||||||
|
manager.setHeaderHovered(true);
|
||||||
|
manager.setFooterHovered(true);
|
||||||
|
manager.updateWindowHeight(412);
|
||||||
|
|
||||||
|
manager.togglePinned();
|
||||||
|
expect(manager.getVisibilityState()).toEqual({headerVisible: true, footerVisible: true});
|
||||||
|
|
||||||
|
manager.togglePinned();
|
||||||
|
expect(manager.getVisibilityState()).toEqual({headerVisible: false, footerVisible: false});
|
||||||
|
|
||||||
|
manager.handleFooterZoneEnter();
|
||||||
|
manager.handleMouseLeave();
|
||||||
|
expect(manager.getVisibilityState()).toEqual({headerVisible: false, footerVisible: false});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface HeaderFooterVisibilityState {
|
|||||||
export class ReaderHeaderFooterVisibilityManager {
|
export class ReaderHeaderFooterVisibilityManager {
|
||||||
private isPinned = false;
|
private isPinned = false;
|
||||||
private isImmersive = false;
|
private isImmersive = false;
|
||||||
private mouseY: number;
|
private mouseY: number | null = null;
|
||||||
|
|
||||||
private readonly HEADER_TRIGGER_ZONE = 20;
|
private readonly HEADER_TRIGGER_ZONE = 20;
|
||||||
private readonly FOOTER_TRIGGER_ZONE = 30;
|
private readonly FOOTER_TRIGGER_ZONE = 30;
|
||||||
@@ -19,9 +19,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
|
|
||||||
private onStateChangeCallback?: (state: HeaderFooterVisibilityState) => void;
|
private onStateChangeCallback?: (state: HeaderFooterVisibilityState) => void;
|
||||||
|
|
||||||
constructor(private windowHeight: number) {
|
constructor(private windowHeight: number, private readonly followsPointer = true) {}
|
||||||
this.mouseY = windowHeight / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
onStateChange(callback: (state: HeaderFooterVisibilityState) => void): void {
|
onStateChange(callback: (state: HeaderFooterVisibilityState) => void): void {
|
||||||
this.onStateChangeCallback = callback;
|
this.onStateChangeCallback = callback;
|
||||||
@@ -32,6 +30,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMouseMove(mouseY: number): void {
|
handleMouseMove(mouseY: number): void {
|
||||||
|
if (!this.followsPointer) return;
|
||||||
this.mouseY = mouseY;
|
this.mouseY = mouseY;
|
||||||
if (!this.isImmersive) {
|
if (!this.isImmersive) {
|
||||||
this.updateVisibility();
|
this.updateVisibility();
|
||||||
@@ -39,6 +38,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMouseLeave(): void {
|
handleMouseLeave(): void {
|
||||||
|
this.mouseY = null;
|
||||||
this.headerHovered = false;
|
this.headerHovered = false;
|
||||||
this.footerHovered = false;
|
this.footerHovered = false;
|
||||||
if (!this.isPinned && !this.isImmersive) {
|
if (!this.isPinned && !this.isImmersive) {
|
||||||
@@ -49,20 +49,21 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleHeaderZoneEnter(): void {
|
handleHeaderZoneEnter(): void {
|
||||||
if (!this.isPinned && !this.isImmersive) {
|
if (this.followsPointer && !this.isPinned && !this.isImmersive) {
|
||||||
this.setHeaderVisible(true);
|
this.setHeaderVisible(true);
|
||||||
this.notifyStateChange();
|
this.notifyStateChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFooterZoneEnter(): void {
|
handleFooterZoneEnter(): void {
|
||||||
if (!this.isPinned && !this.isImmersive) {
|
if (this.followsPointer && !this.isPinned && !this.isImmersive) {
|
||||||
this.setFooterVisible(true);
|
this.setFooterVisible(true);
|
||||||
this.notifyStateChange();
|
this.notifyStateChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setHeaderHovered(hovered: boolean): void {
|
setHeaderHovered(hovered: boolean): void {
|
||||||
|
if (!this.followsPointer) return;
|
||||||
this.headerHovered = hovered;
|
this.headerHovered = hovered;
|
||||||
if (!this.isImmersive) {
|
if (!this.isImmersive) {
|
||||||
this.updateVisibility();
|
this.updateVisibility();
|
||||||
@@ -70,6 +71,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setFooterHovered(hovered: boolean): void {
|
setFooterHovered(hovered: boolean): void {
|
||||||
|
if (!this.followsPointer) return;
|
||||||
this.footerHovered = hovered;
|
this.footerHovered = hovered;
|
||||||
if (!this.isImmersive) {
|
if (!this.isImmersive) {
|
||||||
this.updateVisibility();
|
this.updateVisibility();
|
||||||
@@ -123,7 +125,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
|
|
||||||
private updateVisibility(): void {
|
private updateVisibility(): void {
|
||||||
if (
|
if (
|
||||||
this.mouseY <= this.HEADER_TRIGGER_ZONE ||
|
(this.mouseY !== null && this.mouseY <= this.HEADER_TRIGGER_ZONE) ||
|
||||||
this.headerHovered ||
|
this.headerHovered ||
|
||||||
this.isPinned
|
this.isPinned
|
||||||
) {
|
) {
|
||||||
@@ -133,7 +135,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.mouseY >= this.windowHeight - this.FOOTER_TRIGGER_ZONE ||
|
(this.mouseY !== null && this.mouseY >= this.windowHeight - this.FOOTER_TRIGGER_ZONE) ||
|
||||||
this.footerHovered ||
|
this.footerHovered ||
|
||||||
this.isPinned
|
this.isPinned
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
@include surface;
|
@include surface;
|
||||||
|
@include sidebar-edge(left, $sidebar-width);
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: $sidebar-width;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-shadow: 12px 0 32px rgb(0 0 0 / 40%);
|
box-shadow: 12px 0 32px rgb(0 0 0 / 40%);
|
||||||
|
|||||||
@@ -5,14 +5,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@if (!isLoading()) {
|
@if (!isLoading()) {
|
||||||
<div class="pdf-reader-container" [class.dark]="isDarkTheme()" [class.v-hidden]="viewerMode() === 'book' && !isInitialScrollDone()" [class.footer-hidden]="!footerVisible()">
|
<div class="pdf-reader-container" [class.dark]="isDarkTheme()" [class.v-hidden]="viewerMode() === 'book' && !isInitialScrollDone()" [class.footer-hidden]="!footerShown()">
|
||||||
|
@for (color of [topBarColor()]; track color) {
|
||||||
|
<div class="browser-bar top-0" [style.background]="color" aria-hidden="true"></div>
|
||||||
|
}
|
||||||
|
@for (color of [bottomBarColor()]; track color) {
|
||||||
|
<div class="browser-bar bottom-0" [style.background]="color" aria-hidden="true"></div>
|
||||||
|
}
|
||||||
|
|
||||||
<!-- Footer trigger zone -->
|
<!-- Footer trigger zone -->
|
||||||
<div class="footer-trigger-zone" [class.inactive]="footerVisible()" (mouseenter)="onFooterTriggerZoneEnter()"></div>
|
<div class="footer-trigger-zone" [class.inactive]="footerShown()" (mouseenter)="visibilityManager.handleFooterZoneEnter()"></div>
|
||||||
|
|
||||||
@if (viewerMode() === 'book') {
|
@if (viewerMode() === 'book') {
|
||||||
<!-- Header trigger zone -->
|
<!-- Header trigger zone -->
|
||||||
<div class="header-trigger-zone" [class.inactive]="headerVisible()" (mouseenter)="onHeaderTriggerZoneEnter()"></div>
|
<div class="header-trigger-zone" [class.inactive]="headerShown()" (mouseenter)="visibilityManager.handleHeaderZoneEnter()"></div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (viewerMode() === 'document') {
|
@if (viewerMode() === 'document') {
|
||||||
@@ -44,7 +50,7 @@
|
|||||||
@if (viewerMode() === 'book') {
|
@if (viewerMode() === 'book') {
|
||||||
|
|
||||||
<!-- Book header toolbar -->
|
<!-- Book header toolbar -->
|
||||||
<div class="pdf-header-toolbar" [class.chrome-hidden]="!headerVisible()">
|
<div class="pdf-header-toolbar" [class.chrome-hidden]="!headerShown()" (mouseenter)="visibilityManager.setHeaderHovered(true)" (mouseleave)="visibilityManager.setHeaderHovered(false)">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<ng-container *ngTemplateOutlet="actionBtn; context: { id: 'sidebar' }"></ng-container>
|
<ng-container *ngTemplateOutlet="actionBtn; context: { id: 'sidebar' }"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,7 +150,7 @@
|
|||||||
|
|
||||||
<!-- Search bar (slides below header) -->
|
<!-- Search bar (slides below header) -->
|
||||||
@if (isSearchOpen()) {
|
@if (isSearchOpen()) {
|
||||||
<div class="search-bar" [class.chrome-hidden]="!headerVisible()">
|
<div class="search-bar" [class.chrome-hidden]="!headerShown()">
|
||||||
<div class="search-input-wrapper">
|
<div class="search-input-wrapper">
|
||||||
<app-reader-icon name="search" [size]="14" />
|
<app-reader-icon name="search" [size]="14" />
|
||||||
<input type="text" class="search-input" #searchInput
|
<input type="text" class="search-input" #searchInput
|
||||||
@@ -167,7 +173,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<!-- Book viewer container -->
|
<!-- Book viewer container -->
|
||||||
<div #bookViewerContainer id="book-viewer" class="book-viewer-container" [class.horizontal-scroll]="scrollLayout() === 'horizontal'"></div>
|
<div #bookViewerContainer id="book-viewer" class="book-viewer-container" [class.horizontal-scroll]="scrollLayout() === 'horizontal'" [style.background-color]="pageColor()"></div>
|
||||||
|
|
||||||
<!-- Sidebar -->
|
<!-- Sidebar -->
|
||||||
<app-pdf-sidebar
|
<app-pdf-sidebar
|
||||||
@@ -184,7 +190,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<!-- Footer (shared across both viewer modes) -->
|
<!-- Footer (shared across both viewer modes) -->
|
||||||
<div class="pdf-footer" [class.is-visible]="footerVisible()">
|
<div class="pdf-footer" [class.is-visible]="footerShown()" (mouseenter)="visibilityManager.setFooterHovered(true)" (mouseleave)="visibilityManager.setFooterHovered(false)">
|
||||||
<div class="page-nav-left">
|
<div class="page-nav-left">
|
||||||
<button class="nav-btn" (click)="goToFirstPage()" [disabled]="page() <= 1"
|
<button class="nav-btn" (click)="goToFirstPage()" [disabled]="page() <= 1"
|
||||||
[title]="'readerPdf.footer.firstPage' | transloco" [attr.aria-label]="'readerPdf.footer.firstPage' | transloco">
|
[title]="'readerPdf.footer.firstPage' | transloco" [attr.aria-label]="'readerPdf.footer.firstPage' | transloco">
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.pdf-reader-container {
|
.pdf-reader-container {
|
||||||
@include tokens;
|
@include tokens;
|
||||||
|
@include safe-area;
|
||||||
|
|
||||||
|
--reader-header-height: calc(#{$header-height} + var(--safe-edge-top));
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -54,6 +57,10 @@ $transition-fast: 150ms ease;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.browser-bar {
|
||||||
|
@include browser-bar;
|
||||||
|
}
|
||||||
|
|
||||||
// --- Trigger zones ---
|
// --- Trigger zones ---
|
||||||
|
|
||||||
.header-trigger-zone,
|
.header-trigger-zone,
|
||||||
@@ -89,9 +96,9 @@ $transition-fast: 150ms ease;
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: $header-height;
|
height: var(--reader-header-height);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 16px;
|
padding: var(--safe-edge-top) calc(16px + var(--safe-edge-right)) 0 calc(16px + var(--safe-edge-left));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -197,7 +204,7 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.search-bar {
|
.search-bar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: $header-height;
|
top: var(--reader-header-height);
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
@@ -206,7 +213,7 @@ $transition-fast: 150ms ease;
|
|||||||
border-bottom: 1px solid $border-color;
|
border-bottom: 1px solid $border-color;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 16px;
|
padding: 0 calc(16px + var(--safe-edge-right)) 0 calc(16px + var(--safe-edge-left));
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
@@ -311,6 +318,7 @@ $transition-fast: 150ms ease;
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden auto;
|
overflow: hidden auto;
|
||||||
|
padding: var(--safe-edge-top) var(--safe-edge-right) var(--safe-edge-bottom) var(--safe-edge-left);
|
||||||
|
|
||||||
&.horizontal-scroll {
|
&.horizontal-scroll {
|
||||||
overflow: auto hidden;
|
overflow: auto hidden;
|
||||||
@@ -330,9 +338,8 @@ $transition-fast: 150ms ease;
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: $footer-height;
|
height: calc(#{$footer-height} + var(--safe-edge-bottom));
|
||||||
padding: 0 16px;
|
padding: 0 calc(16px + var(--safe-edge-right)) var(--safe-edge-bottom) calc(16px + var(--safe-edge-left));
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -576,8 +583,8 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.embed-header-actions {
|
.embed-header-actions {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: var(--safe-edge-top);
|
||||||
right: 10px;
|
right: calc(10px + var(--safe-edge-right));
|
||||||
height: $header-height;
|
height: $header-height;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -587,9 +594,7 @@ $transition-fast: 150ms ease;
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
@media (width <= 1024px) {
|
@media (width <= 1024px) {
|
||||||
top: env(safe-area-inset-top);
|
right: calc(8px + var(--safe-edge-right));
|
||||||
height: calc(#{$header-height} + 4px);
|
|
||||||
right: 8px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,8 +660,8 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.doc-viewer-info {
|
.doc-viewer-info {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 48px;
|
top: calc(var(--reader-header-height) + 10px);
|
||||||
right: 12px;
|
right: calc(12px + var(--safe-edge-right));
|
||||||
z-index: 1010;
|
z-index: 1010;
|
||||||
background: color-mix(in srgb, var(--reader-chrome-bg-raised) 90%, transparent);
|
background: color-mix(in srgb, var(--reader-chrome-bg-raised) 90%, transparent);
|
||||||
color: $text-primary;
|
color: $text-primary;
|
||||||
@@ -708,7 +713,6 @@ $transition-fast: 150ms ease;
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
transition: inset 0.25s ease-out, height 0.25s ease-out;
|
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -717,13 +721,6 @@ $transition-fast: 150ms ease;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pdf-reader-container.footer-hidden {
|
|
||||||
#embedpdf-viewer {
|
|
||||||
inset: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.goto-page {
|
.goto-page {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -804,8 +801,11 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.toolbar-overflow-menu {
|
.toolbar-overflow-menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: $header-height;
|
top: var(--reader-header-height);
|
||||||
right: 8px;
|
right: calc(8px + var(--safe-edge-right));
|
||||||
|
max-height: calc(100dvh - var(--reader-header-height) - var(--safe-edge-panel-bottom));
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
z-index: 1010;
|
z-index: 1010;
|
||||||
background: $chrome-bg-raised;
|
background: $chrome-bg-raised;
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
@@ -852,20 +852,28 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
// --- Responsive ---
|
// --- Responsive ---
|
||||||
|
|
||||||
// Tablet (portrait) switches to mobile toolbar layout
|
// When footer is visible on mobile/tablet, it pushes the PDF viewer
|
||||||
@media (width <= 1024px) {
|
@media (width <= 1024px), (pointer: coarse) {
|
||||||
// When footer is visible on mobile/tablet, it pushes the PDF viewer
|
.pdf-reader-container:has(> #embedpdf-viewer):not(.footer-hidden) {
|
||||||
.pdf-reader-container:not(.footer-hidden) {
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
#embedpdf-viewer {
|
#embedpdf-viewer {
|
||||||
inset: 0 0 $footer-height;
|
position: relative;
|
||||||
height: calc(100% - #{$footer-height});
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pdf-footer {
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tablet (portrait) switches to mobile toolbar layout
|
||||||
|
@media (width <= 1024px) {
|
||||||
.pdf-header-toolbar {
|
.pdf-header-toolbar {
|
||||||
height: calc(#{$header-height} + 4px + env(safe-area-inset-top));
|
padding: var(--safe-edge-top) calc(8px + var(--safe-edge-right)) 0 calc(8px + var(--safe-edge-left));
|
||||||
padding: 0 8px;
|
|
||||||
padding-top: env(safe-area-inset-top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-btn.close-btn {
|
.icon-btn.close-btn {
|
||||||
@@ -884,8 +892,7 @@ $transition-fast: 150ms ease;
|
|||||||
|
|
||||||
.pdf-footer {
|
.pdf-footer {
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 8px 12px;
|
padding: 8px calc(12px + var(--safe-edge-right)) calc(8px + var(--safe-edge-bottom)) calc(12px + var(--safe-edge-left));
|
||||||
padding-bottom: calc(8px + env(safe-area-inset-bottom));
|
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
@@ -915,17 +922,14 @@ $transition-fast: 150ms ease;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search-bar {
|
.search-bar {
|
||||||
top: calc(#{$header-height} + 4px + env(safe-area-inset-top));
|
|
||||||
|
|
||||||
.search-input-wrapper {
|
.search-input-wrapper {
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.doc-viewer-info {
|
.doc-viewer-info {
|
||||||
right: 12px;
|
right: calc(12px + var(--safe-edge-right));
|
||||||
left: 12px;
|
left: calc(12px + var(--safe-edge-left));
|
||||||
top: calc(48px + env(safe-area-inset-top));
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -943,9 +947,8 @@ $transition-fast: 150ms ease;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-overflow-menu {
|
.toolbar-overflow-menu {
|
||||||
top: calc(#{$header-height} + 4px + env(safe-area-inset-top));
|
right: calc(4px + var(--safe-edge-right));
|
||||||
right: 4px;
|
left: calc(4px + var(--safe-edge-left));
|
||||||
left: 4px;
|
|
||||||
min-width: unset;
|
min-width: unset;
|
||||||
|
|
||||||
.overflow-item {
|
.overflow-item {
|
||||||
@@ -974,13 +977,11 @@ $transition-fast: 150ms ease;
|
|||||||
// Small phones
|
// Small phones
|
||||||
@media (width <= 480px) {
|
@media (width <= 480px) {
|
||||||
.pdf-header-toolbar {
|
.pdf-header-toolbar {
|
||||||
padding: 0 6px;
|
padding: var(--safe-edge-top) calc(6px + var(--safe-edge-right)) 0 calc(6px + var(--safe-edge-left));
|
||||||
padding-top: env(safe-area-inset-top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pdf-footer {
|
.pdf-footer {
|
||||||
padding: 6px 8px;
|
padding: 6px calc(8px + var(--safe-edge-right)) calc(6px + var(--safe-edge-bottom)) calc(8px + var(--safe-edge-left));
|
||||||
padding-bottom: calc(6px + env(safe-area-inset-bottom));
|
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, ElementRef, inject, Injector, NgZone, OnDestroy, OnInit, afterNextRender, viewChild, DestroyRef, signal, computed } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, ElementRef, HostListener, inject, Injector, NgZone, OnDestroy, OnInit, afterNextRender, viewChild, DestroyRef, signal, computed } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { PageTitleService } from "../../../shared/service/page-title.service";
|
import { PageTitleService } from "../../../shared/service/page-title.service";
|
||||||
@@ -13,11 +13,13 @@ import { API_CONFIG } from '../../../core/config/api-config';
|
|||||||
import { PdfAnnotationService } from '../../../shared/service/pdf-annotation.service';
|
import { PdfAnnotationService } from '../../../shared/service/pdf-annotation.service';
|
||||||
import { ReaderIconComponent } from '../../readers/ebook-reader/shared/icon.component';
|
import { ReaderIconComponent } from '../../readers/ebook-reader/shared/icon.component';
|
||||||
import { BookMark } from '../../../shared/service/book-mark.service';
|
import { BookMark } from '../../../shared/service/book-mark.service';
|
||||||
import { EmbedPdfBookService, PdfOutlineItem, PdfScrollLayout } from './services/embedpdf-book.service';
|
import { EmbedPdfBookService, PDF_PAGE_COLOR, PdfOutlineItem, PdfScrollLayout } from './services/embedpdf-book.service';
|
||||||
import type { AnnotationTransferItem } from '@embedpdf/snippet';
|
import type { AnnotationTransferItem } from '@embedpdf/snippet';
|
||||||
import { PdfBookmarkService } from './services/pdf-bookmark.service';
|
import { PdfBookmarkService } from './services/pdf-bookmark.service';
|
||||||
import { PdfSidebarComponent, PdfAnnotationListItem } from './components/pdf-sidebar.component';
|
import { PdfSidebarComponent, PdfAnnotationListItem } from './components/pdf-sidebar.component';
|
||||||
import { parseStoredAnnotations, serializeAnnotations } from './utils/annotation-converter';
|
import { parseStoredAnnotations, serializeAnnotations } from './utils/annotation-converter';
|
||||||
|
import { ReaderHeaderFooterVisibilityManager } from '../ebook-reader/shared/visibility.util';
|
||||||
|
import { isTouchScreen, setupReaderEdges } from '../shared/reader-edges.util';
|
||||||
|
|
||||||
import { ProgressSpinner } from '@openng/optimus-ui/progressspinner';
|
import { ProgressSpinner } from '@openng/optimus-ui/progressspinner';
|
||||||
import { MessageService } from '@openng/optimus-ui/api';
|
import { MessageService } from '@openng/optimus-ui/api';
|
||||||
@@ -59,8 +61,8 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
readonly viewerMode = signal<'book' | 'document'>('book');
|
readonly viewerMode = signal<'book' | 'document'>('book');
|
||||||
readonly docViewerReady = signal(false);
|
readonly docViewerReady = signal(false);
|
||||||
readonly isDocViewerInfoVisible = signal(false);
|
readonly isDocViewerInfoVisible = signal(false);
|
||||||
readonly headerVisible = signal(true);
|
readonly headerVisible = signal(false);
|
||||||
readonly footerVisible = signal(true);
|
readonly footerVisible = signal(false);
|
||||||
readonly sidebarOpen = signal(false);
|
readonly sidebarOpen = signal(false);
|
||||||
readonly isSearchOpen = signal(false);
|
readonly isSearchOpen = signal(false);
|
||||||
readonly isPanActive = signal(false);
|
readonly isPanActive = signal(false);
|
||||||
@@ -78,6 +80,16 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
readonly isInitialScrollDone = signal(false);
|
readonly isInitialScrollDone = signal(false);
|
||||||
|
|
||||||
|
readonly pageColor = computed(() => this.isDarkTheme() ? PDF_PAGE_COLOR.dark : PDF_PAGE_COLOR.light);
|
||||||
|
readonly headerShown = computed(() => this.headerVisible() || this.isSearchOpen() || this.isToolbarOverflowOpen());
|
||||||
|
readonly footerShown = computed(() => this.footerVisible() || (isTouchScreen() && this.viewerMode() === 'document'));
|
||||||
|
readonly topBarColor = computed(() => {
|
||||||
|
if (this.viewerMode() === 'document') return this.isDarkTheme() ? '#2d2d2d' : '#f0f0f0';
|
||||||
|
return this.headerShown() ? 'var(--reader-chrome-bg)' : this.pageColor();
|
||||||
|
});
|
||||||
|
readonly bottomBarColor = computed(() => this.footerShown() ? 'var(--reader-chrome-bg)' : this.pageColor());
|
||||||
|
protected readonly visibilityManager = new ReaderHeaderFooterVisibilityManager(window.innerHeight, !isTouchScreen());
|
||||||
|
|
||||||
readonly sliderTicks = computed(() => {
|
readonly sliderTicks = computed(() => {
|
||||||
const total = this.totalPages();
|
const total = this.totalPages();
|
||||||
if (total <= 1) return [];
|
if (total <= 1) return [];
|
||||||
@@ -135,17 +147,11 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
// Book mode state
|
// Book mode state
|
||||||
private bookViewerInitialized = false;
|
private bookViewerInitialized = false;
|
||||||
|
|
||||||
// Chrome auto-hide
|
private mouseCleanup?: () => void;
|
||||||
private chromeAutoHideTimer?: ReturnType<typeof setTimeout>;
|
|
||||||
private readonly CHROME_HIDE_DELAY = 3000;
|
|
||||||
private mouseMoveCleanup?: () => void;
|
|
||||||
private documentClickCleanup?: () => void;
|
private documentClickCleanup?: () => void;
|
||||||
private keydownCleanup?: () => void;
|
private keydownCleanup?: () => void;
|
||||||
private touchCleanup?: () => void;
|
private touchCleanup?: () => void;
|
||||||
private lastMouseMoveTime = 0;
|
|
||||||
|
|
||||||
// Mobile touch navigation
|
|
||||||
private isMobile = false;
|
|
||||||
readonly overflowMenuRef = viewChild<ElementRef<HTMLDivElement>>('overflowMenu');
|
readonly overflowMenuRef = viewChild<ElementRef<HTMLDivElement>>('overflowMenu');
|
||||||
readonly bookViewerContainerRef = viewChild<ElementRef<HTMLDivElement>>('bookViewerContainer');
|
readonly bookViewerContainerRef = viewChild<ElementRef<HTMLDivElement>>('bookViewerContainer');
|
||||||
private touchStartX = 0;
|
private touchStartX = 0;
|
||||||
@@ -195,6 +201,14 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
private readonly ngZone = inject(NgZone);
|
private readonly ngZone = inject(NgZone);
|
||||||
private userPanPreferred = false;
|
private userPanPreferred = false;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.visibilityManager.onStateChange(state => {
|
||||||
|
this.headerVisible.set(state.headerVisible);
|
||||||
|
this.footerVisible.set(state.footerVisible);
|
||||||
|
});
|
||||||
|
|
||||||
|
setupReaderEdges(this.pageColor);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const dismissed = localStorage.getItem(this.DOC_VIEWER_DISMISSED_KEY);
|
const dismissed = localStorage.getItem(this.DOC_VIEWER_DISMISSED_KEY);
|
||||||
@@ -219,10 +233,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
window.addEventListener('resize', syncPhoneMode);
|
window.addEventListener('resize', syncPhoneMode);
|
||||||
this.destroyRef.onDestroy(() => window.removeEventListener('resize', syncPhoneMode));
|
this.destroyRef.onDestroy(() => window.removeEventListener('resize', syncPhoneMode));
|
||||||
|
|
||||||
this.isMobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
||||||
|
|
||||||
setTimeout(() => this.wakeLockService.enable(), 1000);
|
setTimeout(() => this.wakeLockService.enable(), 1000);
|
||||||
this.startChromeAutoHide();
|
|
||||||
document.addEventListener('fullscreenchange', this.onFullscreenChange);
|
document.addEventListener('fullscreenchange', this.onFullscreenChange);
|
||||||
|
|
||||||
this.t.langChanges$
|
this.t.langChanges$
|
||||||
@@ -237,17 +248,16 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
// Listen for mousemove outside Angular zone to avoid constant change detection
|
// Listen for mousemove outside Angular zone to avoid constant change detection
|
||||||
this.ngZone.runOutsideAngular(() => {
|
this.ngZone.runOutsideAngular(() => {
|
||||||
const mouseMoveHandler = () => {
|
const mouseMoveHandler = (e: MouseEvent) => this.visibilityManager.handleMouseMove(e.clientY);
|
||||||
const now = Date.now();
|
const mouseLeaveHandler = () => this.visibilityManager.handleMouseLeave();
|
||||||
if (now - this.lastMouseMoveTime < 200) return;
|
|
||||||
this.lastMouseMoveTime = now;
|
|
||||||
this.ngZone.run(() => {
|
|
||||||
this.showChrome();
|
|
||||||
this.startChromeAutoHide();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
document.addEventListener('mousemove', mouseMoveHandler);
|
document.addEventListener('mousemove', mouseMoveHandler);
|
||||||
this.mouseMoveCleanup = () => document.removeEventListener('mousemove', mouseMoveHandler);
|
document.addEventListener('mouseover', mouseMoveHandler);
|
||||||
|
document.addEventListener('mouseleave', mouseLeaveHandler);
|
||||||
|
this.mouseCleanup = () => {
|
||||||
|
document.removeEventListener('mousemove', mouseMoveHandler);
|
||||||
|
document.removeEventListener('mouseover', mouseMoveHandler);
|
||||||
|
document.removeEventListener('mouseleave', mouseLeaveHandler);
|
||||||
|
};
|
||||||
|
|
||||||
const clickHandler = (e: MouseEvent) => {
|
const clickHandler = (e: MouseEvent) => {
|
||||||
if (!this.isZoomMenuOpen()) return;
|
if (!this.isZoomMenuOpen()) return;
|
||||||
@@ -1016,6 +1026,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
theme: this.isDarkTheme() ? 'dark' : 'light',
|
theme: this.isDarkTheme() ? 'dark' : 'light',
|
||||||
locale: this.t.getActiveLang()
|
locale: this.t.getActiveLang()
|
||||||
}, location.origin);
|
}, location.origin);
|
||||||
|
this.postSafeArea();
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[EmbedPDF] FATAL:', err);
|
console.error('[EmbedPDF] FATAL:', err);
|
||||||
@@ -1278,7 +1289,6 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
this.clearDocProgressReleaseTimer();
|
this.clearDocProgressReleaseTimer();
|
||||||
if (this.pdfFetchAbortController) this.pdfFetchAbortController.abort();
|
if (this.pdfFetchAbortController) this.pdfFetchAbortController.abort();
|
||||||
this.wakeLockService.disable();
|
this.wakeLockService.disable();
|
||||||
if (this.chromeAutoHideTimer) clearTimeout(this.chromeAutoHideTimer);
|
|
||||||
|
|
||||||
// Save progress via fetch+keepalive so it survives navigation
|
// Save progress via fetch+keepalive so it survives navigation
|
||||||
this.saveProgressSync();
|
this.saveProgressSync();
|
||||||
@@ -1296,7 +1306,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
this.destroyDocViewerIframe();
|
this.destroyDocViewerIframe();
|
||||||
|
|
||||||
document.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
document.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
||||||
this.mouseMoveCleanup?.();
|
this.mouseCleanup?.();
|
||||||
this.documentClickCleanup?.();
|
this.documentClickCleanup?.();
|
||||||
this.keydownCleanup?.();
|
this.keydownCleanup?.();
|
||||||
this.touchCleanup?.();
|
this.touchCleanup?.();
|
||||||
@@ -1316,33 +1326,6 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Chrome auto-hide ---
|
|
||||||
|
|
||||||
showChrome(): void {
|
|
||||||
this.headerVisible.set(true);
|
|
||||||
this.footerVisible.set(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
hideChrome(): void {
|
|
||||||
this.headerVisible.set(false);
|
|
||||||
this.footerVisible.set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private startChromeAutoHide(): void {
|
|
||||||
if (this.chromeAutoHideTimer) clearTimeout(this.chromeAutoHideTimer);
|
|
||||||
this.chromeAutoHideTimer = setTimeout(() => this.hideChrome(), this.CHROME_HIDE_DELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
onHeaderTriggerZoneEnter(): void {
|
|
||||||
this.headerVisible.set(true);
|
|
||||||
this.startChromeAutoHide();
|
|
||||||
}
|
|
||||||
|
|
||||||
onFooterTriggerZoneEnter(): void {
|
|
||||||
this.footerVisible.set(true);
|
|
||||||
this.startChromeAutoHide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Touch navigation ---
|
// --- Touch navigation ---
|
||||||
|
|
||||||
private handleTouchEnd(e: TouchEvent): void {
|
private handleTouchEnd(e: TouchEvent): void {
|
||||||
@@ -1389,12 +1372,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
this.goToNextPage();
|
this.goToNextPage();
|
||||||
} else {
|
} else {
|
||||||
// Center zone (or any zone on phone): toggle chrome
|
// Center zone (or any zone on phone): toggle chrome
|
||||||
if (this.headerVisible() || this.footerVisible()) {
|
this.visibilityManager.togglePinned();
|
||||||
this.hideChrome();
|
|
||||||
} else {
|
|
||||||
this.showChrome();
|
|
||||||
this.startChromeAutoHide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1434,6 +1412,20 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:resize')
|
||||||
|
onWindowResize(): void {
|
||||||
|
this.visibilityManager.updateWindowHeight(window.innerHeight);
|
||||||
|
this.postSafeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
private postSafeArea(): void {
|
||||||
|
const iframe = this.embedPdfIframe;
|
||||||
|
if (!iframe?.contentWindow) return;
|
||||||
|
const style = getComputedStyle(iframe);
|
||||||
|
const [top, right, left] = ['top', 'right', 'left'].map(side => style.getPropertyValue(`--safe-edge-${side}`));
|
||||||
|
iframe.contentWindow.postMessage({type: 'safeArea', top, right, left}, location.origin);
|
||||||
|
}
|
||||||
|
|
||||||
private onFullscreenChange = (): void => {
|
private onFullscreenChange = (): void => {
|
||||||
this.isFullscreen.set(!!document.fullscreenElement);
|
this.isFullscreen.set(!!document.fullscreenElement);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ interface GrimmoryWindowState {
|
|||||||
__grimmoryOrigRelease?: typeof Element.prototype.releasePointerCapture;
|
__grimmoryOrigRelease?: typeof Element.prototype.releasePointerCapture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PDF_PAGE_COLOR = {dark: '#1a1a1a', light: '#f5f5f5'};
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class EmbedPdfBookService {
|
export class EmbedPdfBookService {
|
||||||
private zone = inject(NgZone);
|
private zone = inject(NgZone);
|
||||||
@@ -744,7 +746,7 @@ export class EmbedPdfBookService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
--ep-background-app: #1a1a1a;
|
--ep-background-app: ${PDF_PAGE_COLOR.dark};
|
||||||
--ep-background-surface: #2d2d2d;
|
--ep-background-surface: #2d2d2d;
|
||||||
--ep-border-default: #404040;
|
--ep-border-default: #404040;
|
||||||
--ep-border-subtle: #333333;
|
--ep-border-subtle: #333333;
|
||||||
@@ -754,7 +756,7 @@ export class EmbedPdfBookService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:host([data-color-scheme="light"]) {
|
:host([data-color-scheme="light"]) {
|
||||||
--ep-background-app: #f5f5f5;
|
--ep-background-app: ${PDF_PAGE_COLOR.light};
|
||||||
--ep-background-surface: #ffffff;
|
--ep-background-surface: #ffffff;
|
||||||
--ep-border-default: #d0d0d0;
|
--ep-border-default: #d0d0d0;
|
||||||
--ep-border-subtle: #e0e0e0;
|
--ep-border-subtle: #e0e0e0;
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import {afterNextRender, DestroyRef, effect, inject} from '@angular/core';
|
||||||
|
|
||||||
|
export const isTouchScreen = () => matchMedia('(pointer: coarse)').matches;
|
||||||
|
|
||||||
|
export function setupReaderEdges(stripColor: () => string): () => void {
|
||||||
|
let fullscreenPending = isTouchScreen();
|
||||||
|
let scrollTimer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
|
||||||
|
const requestFullscreen = () => {
|
||||||
|
if (!fullscreenPending || !document.fullscreenEnabled) return;
|
||||||
|
fullscreenPending = false;
|
||||||
|
document.documentElement.requestFullscreen().catch(() => fullscreenPending = true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetScroll = () => {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
clearTimeout(scrollTimer);
|
||||||
|
scrollTimer = setTimeout(() => window.scrollTo(0, 0), 400);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
afterNextRender(requestFullscreen);
|
||||||
|
effect(() => {
|
||||||
|
document.body.style.backgroundColor = stripColor();
|
||||||
|
});
|
||||||
|
document.addEventListener('click', requestFullscreen, true);
|
||||||
|
window.addEventListener('resize', resetScroll);
|
||||||
|
|
||||||
|
inject(DestroyRef).onDestroy(() => {
|
||||||
|
document.removeEventListener('click', requestFullscreen, true);
|
||||||
|
window.removeEventListener('resize', resetScroll);
|
||||||
|
clearTimeout(scrollTimer);
|
||||||
|
document.body.style.backgroundColor = '';
|
||||||
|
if (document.fullscreenElement) void document.exitFullscreen().catch(() => undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
return requestFullscreen;
|
||||||
|
}
|
||||||
@@ -35,3 +35,34 @@
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin safe-area {
|
||||||
|
--reader-browser-bar: 8px;
|
||||||
|
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
--safe-edge-top: max(var(--safe-area-top), var(--reader-browser-bar));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin browser-bar {
|
||||||
|
@include tokens;
|
||||||
|
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: var(--reader-browser-bar);
|
||||||
|
z-index: 9999;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin sidebar-edge($side, $width) {
|
||||||
|
width: calc(#{$width} + var(--safe-edge-#{$side}));
|
||||||
|
padding-top: var(--safe-edge-top);
|
||||||
|
padding-bottom: var(--safe-edge-bottom);
|
||||||
|
padding-#{$side}: var(--safe-edge-#{$side});
|
||||||
|
}
|
||||||
|
|||||||
@@ -162,34 +162,50 @@
|
|||||||
--ep-foreground-secondary: rgba(0,0,0,0.54);
|
--ep-foreground-secondary: rgba(0,0,0,0.54);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-epdf] > :not([data-epdf-i]) {
|
||||||
|
padding-left: var(--grimmory-safe-left, 0px);
|
||||||
|
padding-right: var(--grimmory-safe-right, 0px);
|
||||||
|
background: var(--ep-background-app);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-epdf-i="main-toolbar"] {
|
||||||
|
--toolbar-safe-top: var(--grimmory-safe-top, 0px);
|
||||||
|
}
|
||||||
|
|
||||||
[class*="border-b"][class*="bg-bg-surface"][class*="px-4"][class*="py-2"] {
|
[class*="border-b"][class*="bg-bg-surface"][class*="px-4"][class*="py-2"] {
|
||||||
background: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%) !important;
|
background: #2d2d2d !important;
|
||||||
border-bottom-color: #404040 !important;
|
border-bottom-color: #404040 !important;
|
||||||
box-shadow: 0 2px 8px rgba(0,0,0,0.30) !important;
|
box-shadow: 0 2px 8px rgba(0,0,0,0.30) !important;
|
||||||
height: 38px !important;
|
height: calc(38px + var(--toolbar-safe-top, 0px)) !important;
|
||||||
padding-right: 96px !important;
|
padding-left: calc(16px + var(--grimmory-safe-left, 0px)) !important;
|
||||||
padding-top: 0 !important;
|
padding-right: calc(96px + var(--grimmory-safe-right, 0px)) !important;
|
||||||
|
padding-top: var(--toolbar-safe-top, 0px) !important;
|
||||||
padding-bottom: 0 !important;
|
padding-bottom: 0 !important;
|
||||||
box-sizing: border-box !important;
|
box-sizing: border-box !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host([data-color-scheme="light"]) [class*="border-b"][class*="bg-bg-surface"][class*="px-4"][class*="py-2"] {
|
:host([data-color-scheme="light"]) [class*="border-b"][class*="bg-bg-surface"][class*="px-4"][class*="py-2"] {
|
||||||
background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%) !important;
|
background: #f0f0f0 !important;
|
||||||
border-bottom-color: #d0d0d0 !important;
|
border-bottom-color: #d0d0d0 !important;
|
||||||
box-shadow: 0 2px 8px rgba(0,0,0,0.10) !important;
|
box-shadow: 0 2px 8px rgba(0,0,0,0.10) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-epdf-i="right-group"] {
|
|
||||||
position: relative !important;
|
|
||||||
right: 80px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
[data-epdf-i="right-group"] {
|
[data-epdf-i="right-group"] {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@container (width < 1024px) {
|
||||||
|
[data-epdf-i="mode-tabs"] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-epdf-i="mode-select-button"] {
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Keep viewer popups/menus visible; only hide explicit file controls. */
|
/* Keep viewer popups/menus visible; only hide explicit file controls. */
|
||||||
|
|
||||||
[data-epdf-i="open-document"],
|
[data-epdf-i="open-document"],
|
||||||
@@ -346,6 +362,7 @@
|
|||||||
defaultLocale: msg.locale || 'en',
|
defaultLocale: msg.locale || 'en',
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
},
|
},
|
||||||
|
theme: { preference: msg.theme },
|
||||||
disabledCategories: [
|
disabledCategories: [
|
||||||
'document-open',
|
'document-open',
|
||||||
'document-close',
|
'document-close',
|
||||||
@@ -469,6 +486,12 @@
|
|||||||
applyLocale(registry?.getPlugin('i18n')?.provides?.(), msg.locale);
|
applyLocale(registry?.getPlugin('i18n')?.provides?.(), msg.locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg.type === 'safeArea') {
|
||||||
|
for (const side of ['top', 'right', 'left']) {
|
||||||
|
document.documentElement.style.setProperty('--grimmory-safe-' + side, msg[side]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.type === 'scrollToPage') {
|
if (msg.type === 'scrollToPage') {
|
||||||
const scrollPlugin = registry?.getPlugin('scroll')?.provides();
|
const scrollPlugin = registry?.getPlugin('scroll')?.provides();
|
||||||
scrollPlugin?.scrollToPage({ pageNumber: msg.pageNumber, behavior: 'smooth' });
|
scrollPlugin?.scrollToPage({ pageNumber: msg.pageNumber, behavior: 'smooth' });
|
||||||
|
|||||||
@@ -173,6 +173,30 @@
|
|||||||
--app-text-sm: var(--text-app-sm);
|
--app-text-sm: var(--text-app-sm);
|
||||||
--app-text-base: var(--text-app-base);
|
--app-text-base: var(--text-app-base);
|
||||||
--app-text-lg: var(--text-app-lg);
|
--app-text-lg: var(--text-app-lg);
|
||||||
|
--safe-area-top: env(safe-area-inset-top, 0px);
|
||||||
|
--safe-area-right: env(safe-area-inset-right, 0px);
|
||||||
|
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
|
--safe-area-left: env(safe-area-inset-left, 0px);
|
||||||
|
--safe-edge-gap: 16px;
|
||||||
|
--safe-edge-top: var(--safe-area-top);
|
||||||
|
--safe-edge-right: var(--safe-area-right);
|
||||||
|
--safe-edge-bottom: var(--safe-area-bottom);
|
||||||
|
--safe-edge-left: var(--safe-area-left);
|
||||||
|
--safe-edge-panel-bottom: max(var(--safe-edge-bottom), var(--safe-edge-gap));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
:root {
|
||||||
|
--safe-edge-bottom: calc(var(--safe-area-bottom) + var(--safe-edge-gap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (pointer: coarse) and (orientation: landscape) {
|
||||||
|
:root {
|
||||||
|
--safe-edge-right: max(var(--safe-area-right), var(--safe-edge-gap));
|
||||||
|
--safe-edge-bottom: max(var(--safe-area-bottom), var(--safe-edge-gap));
|
||||||
|
--safe-edge-left: max(var(--safe-area-left), var(--safe-edge-gap));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-ui-font="atkinson"] {
|
[data-ui-font="atkinson"] {
|
||||||
|
|||||||
Reference in New Issue
Block a user