Fix ebook reader text selection and audiobook reader

This commit is contained in:
acx10
2026-02-01 23:49:20 -07:00
parent a402f98e08
commit 17fef505cb
13 changed files with 332 additions and 136 deletions
@@ -299,7 +299,7 @@
@for (book of scroll.viewPortItems; let i = $index; track book.id) {
<div
class="virtual-scroller-item"
[ngStyle]="{width: currentCardSize.width + 'px', height: currentCardSize.height + 'px'}">
[ngStyle]="{width: currentCardSize.width + 'px', height: getCardHeight(book) + 'px'}">
<app-book-card
[index]="books.indexOf(book)"
[book]="book"
@@ -205,6 +205,17 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
return this.coverScalePreferenceService.gridColumnMinWidth;
}
getCardHeight(book: Book): number {
if (this.isMobile) {
const isAudiobook = book.primaryFile?.bookType === 'AUDIOBOOK';
if (isAudiobook) {
return this.mobileCardSize.width + this.MOBILE_TITLE_BAR_HEIGHT;
}
return this.mobileCardSize.height;
}
return this.coverScalePreferenceService.getCardHeight(book);
}
get viewIcon(): string {
return this.currentViewMode === VIEW_MODES.GRID ? 'pi pi-objects-column' : 'pi pi-table';
}
@@ -21,6 +21,11 @@
justify-content: center;
}
.cover-container.audiobook-cover {
aspect-ratio: 1/1;
background-color: var(--surface-ground);
}
.book-cover {
width: 100%;
height: 100%;
@@ -37,10 +42,6 @@
object-fit: contain;
}
.cover-container.audiobook-cover {
background-color: var(--surface-ground);
}
.cover-container::after {
content: "";
position: absolute;
@@ -3,6 +3,7 @@ import {Subject} from 'rxjs';
import {debounceTime} from 'rxjs/operators';
import {MessageService} from 'primeng/api';
import {LocalStorageService} from '../../../../shared/service/local-storage.service';
import {Book} from '../../model/book.model';
@Injectable({
providedIn: 'root'
@@ -11,6 +12,7 @@ export class CoverScalePreferenceService {
private readonly BASE_WIDTH = 135;
private readonly BASE_HEIGHT = 220;
private readonly TITLE_BAR_HEIGHT = 31;
private readonly DEBOUNCE_MS = 1000;
private readonly STORAGE_KEY = 'coverScalePreference';
@@ -50,6 +52,14 @@ export class CoverScalePreferenceService {
return `${this.currentCardSize.width}px`;
}
getCardHeight(book: Book): number {
const isAudiobook = book.primaryFile?.bookType === 'AUDIOBOOK';
if (isAudiobook) {
return Math.round((this.BASE_WIDTH + this.TITLE_BAR_HEIGHT) * this.scaleFactor);
}
return this.currentCardSize.height;
}
private saveScalePreference(scale: number): void {
try {
this.localStorageService.set(this.STORAGE_KEY, scale);