eBook reader bug fixes
This commit is contained in:
@@ -30,6 +30,7 @@ export class ReaderEventService {
|
||||
private readonly LONG_HOLD_THRESHOLD_MS = 500;
|
||||
private readonly LEFT_ZONE_PERCENT = 0.3;
|
||||
private readonly RIGHT_ZONE_PERCENT = 0.7;
|
||||
private readonly SWIPE_THRESHOLD_PX = 50;
|
||||
|
||||
private annotationService = inject(ReaderAnnotationService);
|
||||
|
||||
@@ -42,6 +43,12 @@ export class ReaderEventService {
|
||||
private keydownHandler?: (event: KeyboardEvent) => void;
|
||||
private clickedDocs = new WeakSet<Document>();
|
||||
|
||||
private touchStartX = 0;
|
||||
private touchStartY = 0;
|
||||
private isTextSelectionInProgress = false;
|
||||
private touchStartTime = 0;
|
||||
private selectionChangeTimeout: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
private eventSubject = new Subject<ViewEvent>();
|
||||
public events$ = this.eventSubject.asObservable();
|
||||
|
||||
@@ -78,6 +85,15 @@ export class ReaderEventService {
|
||||
}
|
||||
this.attachIframeEventHandlers(e.detail.doc);
|
||||
}
|
||||
|
||||
const allAnnotations = this.annotationService.getAllAnnotations();
|
||||
if (allAnnotations.length > 0 && this.view) {
|
||||
setTimeout(() => {
|
||||
allAnnotations.forEach(annotation => {
|
||||
this.view?.addAnnotation({value: annotation.value});
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
this.view.addEventListener('relocate', (e: any) => {
|
||||
@@ -137,56 +153,8 @@ export class ReaderEventService {
|
||||
}, this.LONG_HOLD_THRESHOLD_MS);
|
||||
}, true);
|
||||
|
||||
doc.addEventListener('mouseup', (event: MouseEvent) => {
|
||||
setTimeout(() => {
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const range = selection.getRangeAt(0);
|
||||
const text = range.toString().trim();
|
||||
if (!text) return;
|
||||
|
||||
const contents = this.viewCallbacks?.getContents();
|
||||
if (!contents || contents.length === 0) return;
|
||||
|
||||
const {index} = contents[0];
|
||||
const cfi = this.viewCallbacks?.getCFI(index, range);
|
||||
|
||||
if (cfi) {
|
||||
const iframe = doc.defaultView?.frameElement as HTMLIFrameElement | null;
|
||||
const rangeRect = range.getBoundingClientRect();
|
||||
let popupX = rangeRect.left + (rangeRect.width / 2);
|
||||
let selectionTop = rangeRect.top;
|
||||
let selectionBottom = rangeRect.bottom;
|
||||
|
||||
if (iframe) {
|
||||
const iframeRect = iframe.getBoundingClientRect();
|
||||
popupX = iframeRect.left + rangeRect.left + (rangeRect.width / 2);
|
||||
selectionTop = iframeRect.top + rangeRect.top;
|
||||
selectionBottom = iframeRect.top + rangeRect.bottom;
|
||||
}
|
||||
|
||||
const minSpaceAbove = 120;
|
||||
const showBelow = selectionTop < minSpaceAbove;
|
||||
|
||||
let popupY: number;
|
||||
if (showBelow) {
|
||||
popupY = selectionBottom + 10;
|
||||
} else {
|
||||
popupY = selectionTop - 50;
|
||||
}
|
||||
|
||||
popupX = Math.max(100, Math.min(popupX, window.innerWidth - 150));
|
||||
|
||||
this.eventSubject.next({
|
||||
type: 'text-selected',
|
||||
detail: {text, cfi, range, index},
|
||||
popupPosition: {x: popupX, y: popupY, showBelow}
|
||||
});
|
||||
}
|
||||
}, 10);
|
||||
doc.addEventListener('mouseup', () => {
|
||||
this.handleSelectionEnd(doc);
|
||||
});
|
||||
|
||||
doc.addEventListener('click', (event: MouseEvent) => {
|
||||
@@ -207,6 +175,210 @@ export class ReaderEventService {
|
||||
target: (event.target as HTMLElement)?.tagName
|
||||
}, '*');
|
||||
}, true);
|
||||
|
||||
doc.addEventListener('touchstart', (event: TouchEvent) => {
|
||||
this.handleTouchStart(event, doc);
|
||||
}, {passive: true});
|
||||
|
||||
doc.addEventListener('touchmove', (event: TouchEvent) => {
|
||||
this.handleTouchMove(event, doc);
|
||||
}, {passive: false});
|
||||
|
||||
doc.addEventListener('touchend', (event: TouchEvent) => {
|
||||
this.handleTouchEnd(event, doc);
|
||||
}, {passive: false});
|
||||
|
||||
doc.addEventListener('contextmenu', (event: MouseEvent) => {
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
if (selection && !selection.isCollapsed) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
doc.addEventListener('selectionchange', () => {
|
||||
this.handleSelectionChange(doc);
|
||||
});
|
||||
|
||||
this.injectMobileSelectionStyles(doc);
|
||||
}
|
||||
|
||||
private handleSelectionChange(doc: Document): void {
|
||||
if (this.selectionChangeTimeout) {
|
||||
clearTimeout(this.selectionChangeTimeout);
|
||||
}
|
||||
|
||||
this.selectionChangeTimeout = setTimeout(() => {
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const range = selection.getRangeAt(0);
|
||||
const text = range.toString().trim();
|
||||
if (!text) return;
|
||||
|
||||
if ('ontouchstart' in window || navigator.maxTouchPoints > 0) {
|
||||
this.handleSelectionEnd(doc);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
private injectMobileSelectionStyles(doc: Document): void {
|
||||
const styleId = 'booklore-mobile-selection-styles';
|
||||
if (doc.getElementById(styleId)) return;
|
||||
|
||||
const style = doc.createElement('style');
|
||||
style.id = styleId;
|
||||
style.textContent = `
|
||||
* {
|
||||
-webkit-touch-callout: none !important;
|
||||
-webkit-user-select: text !important;
|
||||
user-select: text !important;
|
||||
}
|
||||
`;
|
||||
doc.head.appendChild(style);
|
||||
}
|
||||
|
||||
private handleTouchStart(event: TouchEvent, _doc: Document): void {
|
||||
if (event.touches.length !== 1) return;
|
||||
|
||||
const touch = event.touches[0];
|
||||
this.touchStartX = touch.clientX;
|
||||
this.touchStartY = touch.clientY;
|
||||
this.touchStartTime = Date.now();
|
||||
this.isTextSelectionInProgress = false;
|
||||
|
||||
this.longHoldTimeout = setTimeout(() => {
|
||||
this.longHoldTimeout = null;
|
||||
}, this.LONG_HOLD_THRESHOLD_MS);
|
||||
}
|
||||
|
||||
private handleTouchMove(event: TouchEvent, doc: Document): void {
|
||||
if (event.touches.length !== 1) return;
|
||||
|
||||
const touch = event.touches[0];
|
||||
const deltaX = Math.abs(touch.clientX - this.touchStartX);
|
||||
const deltaY = Math.abs(touch.clientY - this.touchStartY);
|
||||
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
if (selection && !selection.isCollapsed && selection.rangeCount > 0) {
|
||||
this.isTextSelectionInProgress = true;
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (deltaX > 10 && deltaX > deltaY && !this.isTextSelectionInProgress) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private handleTouchEnd(event: TouchEvent, doc: Document): void {
|
||||
const touchEndTime = Date.now();
|
||||
const touchDuration = touchEndTime - this.touchStartTime;
|
||||
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
const hasSelection = selection && !selection.isCollapsed && selection.rangeCount > 0;
|
||||
|
||||
if (hasSelection) {
|
||||
this.isTextSelectionInProgress = false;
|
||||
event.preventDefault();
|
||||
|
||||
setTimeout(() => {
|
||||
this.handleSelectionEnd(doc);
|
||||
}, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isTextSelectionInProgress && event.changedTouches.length === 1) {
|
||||
const touch = event.changedTouches[0];
|
||||
const deltaX = touch.clientX - this.touchStartX;
|
||||
const deltaY = Math.abs(touch.clientY - this.touchStartY);
|
||||
|
||||
if (Math.abs(deltaX) >= this.SWIPE_THRESHOLD_PX && Math.abs(deltaX) > deltaY) {
|
||||
if (this.isNavigating) return;
|
||||
|
||||
this.isNavigating = true;
|
||||
if (deltaX < 0) {
|
||||
this.viewCallbacks?.next();
|
||||
} else {
|
||||
this.viewCallbacks?.prev();
|
||||
}
|
||||
setTimeout(() => this.isNavigating = false, 300);
|
||||
return;
|
||||
}
|
||||
|
||||
if (touchDuration < this.LONG_HOLD_THRESHOLD_MS && Math.abs(deltaX) < 10 && deltaY < 10) {
|
||||
const iframe = doc.defaultView?.frameElement as HTMLIFrameElement | null;
|
||||
if (!iframe) return;
|
||||
|
||||
const iframeRect = iframe.getBoundingClientRect();
|
||||
const viewportX = iframeRect.left + touch.clientX;
|
||||
|
||||
window.postMessage({
|
||||
type: 'iframe-click',
|
||||
clientX: viewportX,
|
||||
clientY: iframeRect.top + touch.clientY,
|
||||
iframeLeft: iframeRect.left,
|
||||
iframeWidth: iframeRect.width,
|
||||
eventClientX: touch.clientX,
|
||||
target: (event.target as HTMLElement)?.tagName
|
||||
}, '*');
|
||||
}
|
||||
}
|
||||
|
||||
this.isTextSelectionInProgress = false;
|
||||
}
|
||||
|
||||
private handleSelectionEnd(doc: Document): void {
|
||||
setTimeout(() => {
|
||||
const selection = doc.defaultView?.getSelection();
|
||||
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const range = selection.getRangeAt(0);
|
||||
const text = range.toString().trim();
|
||||
if (!text) return;
|
||||
|
||||
const contents = this.viewCallbacks?.getContents();
|
||||
if (!contents || contents.length === 0) return;
|
||||
|
||||
const {index} = contents[0];
|
||||
const cfi = this.viewCallbacks?.getCFI(index, range);
|
||||
|
||||
if (cfi) {
|
||||
const iframe = doc.defaultView?.frameElement as HTMLIFrameElement | null;
|
||||
const rangeRect = range.getBoundingClientRect();
|
||||
let popupX = rangeRect.left + (rangeRect.width / 2);
|
||||
let selectionTop = rangeRect.top;
|
||||
let selectionBottom = rangeRect.bottom;
|
||||
|
||||
if (iframe) {
|
||||
const iframeRect = iframe.getBoundingClientRect();
|
||||
popupX = iframeRect.left + rangeRect.left + (rangeRect.width / 2);
|
||||
selectionTop = iframeRect.top + rangeRect.top;
|
||||
selectionBottom = iframeRect.top + rangeRect.bottom;
|
||||
}
|
||||
|
||||
const minSpaceAbove = 120;
|
||||
const showBelow = selectionTop < minSpaceAbove;
|
||||
|
||||
let popupY: number;
|
||||
if (showBelow) {
|
||||
popupY = selectionBottom + 10;
|
||||
} else {
|
||||
popupY = selectionTop - 50;
|
||||
}
|
||||
|
||||
popupX = Math.max(100, Math.min(popupX, window.innerWidth - 150));
|
||||
|
||||
this.eventSubject.next({
|
||||
type: 'text-selected',
|
||||
detail: {text, cfi, range, index},
|
||||
popupPosition: {x: popupX, y: popupY, showBelow}
|
||||
});
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
private handleIframeClickMessage(data: any): void {
|
||||
|
||||
@@ -79,7 +79,6 @@ export class ReaderViewManagerService {
|
||||
|
||||
destroy(): void {
|
||||
this.eventService.destroy();
|
||||
this.annotationService.clearAnnotations();
|
||||
this.view?.remove();
|
||||
this.view = null;
|
||||
}
|
||||
|
||||
+31
-9
@@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { defer, from, Observable, of } from 'rxjs';
|
||||
import { AnnotationStyle } from '../../../../../shared/service/annotation.service';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {defer, from, Observable, of} from 'rxjs';
|
||||
import {AnnotationStyle} from '../../../../../shared/service/annotation.service';
|
||||
|
||||
export type { AnnotationStyle };
|
||||
export type {AnnotationStyle};
|
||||
|
||||
export interface Annotation {
|
||||
value: string;
|
||||
@@ -15,22 +15,31 @@ export interface Annotation {
|
||||
})
|
||||
export class ReaderAnnotationService {
|
||||
private annotationStyles = new Map<string, { color: string; style: AnnotationStyle }>();
|
||||
private allAnnotations: Annotation[] = [];
|
||||
|
||||
addAnnotation(view: any, annotation: Annotation): Observable<{index: number; label: string} | undefined> {
|
||||
addAnnotation(view: any, annotation: Annotation): Observable<{ index: number; label: string } | undefined> {
|
||||
if (!view) return of(undefined);
|
||||
|
||||
const style = annotation.style || 'highlight';
|
||||
const color = annotation.color || '#FFFF00';
|
||||
const color = annotation.color || '#FACC15';
|
||||
|
||||
this.annotationStyles.set(annotation.value, {color, style});
|
||||
|
||||
return defer(() => from(view.addAnnotation({value: annotation.value}) as Promise<{index: number; label: string} | undefined>));
|
||||
const existingIndex = this.allAnnotations.findIndex(a => a.value === annotation.value);
|
||||
if (existingIndex >= 0) {
|
||||
this.allAnnotations[existingIndex] = annotation;
|
||||
} else {
|
||||
this.allAnnotations.push(annotation);
|
||||
}
|
||||
|
||||
return defer(() => from(view.addAnnotation({value: annotation.value}) as Promise<{ index: number; label: string } | undefined>));
|
||||
}
|
||||
|
||||
deleteAnnotation(view: any, cfi: string): Observable<void> {
|
||||
if (!view) return of(undefined);
|
||||
|
||||
this.annotationStyles.delete(cfi);
|
||||
this.allAnnotations = this.allAnnotations.filter(a => a.value !== cfi);
|
||||
|
||||
return defer(() => from(view.deleteAnnotation({value: cfi}) as Promise<void>));
|
||||
}
|
||||
@@ -44,8 +53,16 @@ export class ReaderAnnotationService {
|
||||
addAnnotations(view: any, annotations: Annotation[]): void {
|
||||
annotations.forEach(annotation => {
|
||||
const style = annotation.style || 'highlight';
|
||||
const color = annotation.color || '#FFFF00';
|
||||
const color = annotation.color || '#FACC15';
|
||||
this.annotationStyles.set(annotation.value, {color, style});
|
||||
|
||||
const existingIndex = this.allAnnotations.findIndex(a => a.value === annotation.value);
|
||||
if (existingIndex >= 0) {
|
||||
this.allAnnotations[existingIndex] = annotation;
|
||||
} else {
|
||||
this.allAnnotations.push(annotation);
|
||||
}
|
||||
|
||||
view?.addAnnotation({value: annotation.value});
|
||||
});
|
||||
}
|
||||
@@ -132,7 +149,12 @@ export class ReaderAnnotationService {
|
||||
}
|
||||
}
|
||||
|
||||
clearAnnotations(): void {
|
||||
getAllAnnotations(): Annotation[] {
|
||||
return [...this.allAnnotations];
|
||||
}
|
||||
|
||||
resetAnnotations(): void {
|
||||
this.annotationStyles.clear();
|
||||
this.allAnnotations = [];
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -8,12 +8,13 @@ import {
|
||||
AnnotationStyle,
|
||||
CreateAnnotationRequest
|
||||
} from '../../../../../shared/service/annotation.service';
|
||||
import {Annotation as ViewAnnotation} from './annotation-renderer.service';
|
||||
import {Annotation as ViewAnnotation, ReaderAnnotationService} from './annotation-renderer.service';
|
||||
|
||||
@Injectable()
|
||||
export class ReaderAnnotationHttpService {
|
||||
private annotationService = inject(AnnotationService);
|
||||
private messageService = inject(MessageService);
|
||||
private readerAnnotationService = inject(ReaderAnnotationService);
|
||||
|
||||
private currentChapterTitle: string | null = null;
|
||||
|
||||
@@ -25,7 +26,7 @@ export class ReaderAnnotationHttpService {
|
||||
bookId: number,
|
||||
cfi: string,
|
||||
text: string,
|
||||
color: string = '#FFFF00',
|
||||
color: string = '#FACC15',
|
||||
style: AnnotationStyle = 'highlight',
|
||||
note?: string
|
||||
): Observable<Annotation | null> {
|
||||
@@ -126,5 +127,6 @@ export class ReaderAnnotationHttpService {
|
||||
|
||||
reset(): void {
|
||||
this.currentChapterTitle = null;
|
||||
this.readerAnnotationService.resetAnnotations();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-9
@@ -1,11 +1,7 @@
|
||||
<div class="dialog-overlay" (click)="onOverlayClick($event)">
|
||||
<div class="dialog" (click)="$event.stopPropagation()">
|
||||
<div class="dialog-header">
|
||||
<h3 class="dialog-title">Quick Settings</h3>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
<div class="quick-settings-overlay" (click)="onOverlayClick()">
|
||||
<div class="quick-settings-panel" (click)="$event.stopPropagation()">
|
||||
<div class="pointer"></div>
|
||||
<div class="panel-body">
|
||||
<!-- Dark Mode -->
|
||||
<div class="control">
|
||||
<label>Dark Mode</label>
|
||||
@@ -43,7 +39,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<div class="panel-footer">
|
||||
<button class="more-settings-btn" (click)="onOpenFullSettings()">
|
||||
<app-reader-icon name="settings" [size]="16"></app-reader-icon>
|
||||
<span>More Settings</span>
|
||||
|
||||
+25
-45
@@ -1,5 +1,5 @@
|
||||
// Variables matching sidebar/dialog styling
|
||||
$dialog-bg: #1a1a1a;
|
||||
$panel-bg: #1a1a1a;
|
||||
$text-primary: rgba(255, 255, 255, 0.95);
|
||||
$text-secondary: rgba(255, 255, 255, 0.6);
|
||||
$text-muted: rgba(255, 255, 255, 0.4);
|
||||
@@ -10,11 +10,13 @@ $active-bg: rgba(129, 140, 248, 0.15);
|
||||
$transition-fast: 150ms ease;
|
||||
$transition-normal: 200ms ease;
|
||||
|
||||
.dialog-overlay {
|
||||
.quick-settings-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 12000;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
animation: fadeIn $transition-normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
@@ -22,17 +24,18 @@ $transition-normal: 200ms ease;
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
.dialog {
|
||||
.quick-settings-panel {
|
||||
position: absolute;
|
||||
top: 44px;
|
||||
right: 24px;
|
||||
top: 52px;
|
||||
right: 60px;
|
||||
width: 280px;
|
||||
background: $dialog-bg;
|
||||
background: $panel-bg;
|
||||
border: 1px solid $border-color;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
|
||||
animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
@@ -46,45 +49,21 @@ $transition-normal: 200ms ease;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid $border-color;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
// Pointer arrow
|
||||
.pointer {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: 18px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: $panel-bg;
|
||||
border-left: 1px solid $border-color;
|
||||
border-top: 1px solid $border-color;
|
||||
transform: rotate(45deg);
|
||||
border-radius: 3px 0 0 0;
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: $text-primary;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: $text-muted;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: 6px;
|
||||
transition: background $transition-fast, color $transition-fast;
|
||||
line-height: 1;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&:hover {
|
||||
background: $hover-bg;
|
||||
color: $text-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-body {
|
||||
.panel-body {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
@@ -227,10 +206,11 @@ $transition-normal: 200ms ease;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
.panel-footer {
|
||||
padding: 12px 16px;
|
||||
border-top: 1px solid $border-color;
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0 0 12px 12px;
|
||||
}
|
||||
|
||||
.more-settings-btn {
|
||||
|
||||
+2
-4
@@ -76,9 +76,7 @@ export class ReaderQuickSettingsComponent {
|
||||
this.openFullSettings.emit();
|
||||
}
|
||||
|
||||
onOverlayClick(event: MouseEvent): void {
|
||||
if ((event.target as HTMLElement).classList.contains('quick-settings-overlay')) {
|
||||
this.close.emit();
|
||||
}
|
||||
onOverlayClick(): void {
|
||||
this.close.emit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,6 @@ export class ReaderIconComponent {
|
||||
}
|
||||
|
||||
getLineCoords(d: string, index: number): string {
|
||||
// Parse "M3,6 L21,6" or "3,6 21,6" format
|
||||
const coords = d.replace(/[ML]/g, ' ').trim().split(/[\s,]+/);
|
||||
return coords[index] || '0';
|
||||
}
|
||||
|
||||
+6
-6
@@ -39,16 +39,16 @@ export class TextSelectionPopupComponent {
|
||||
@Output() action = new EventEmitter<TextSelectionAction>();
|
||||
|
||||
showAnnotationOptions = false;
|
||||
selectedColor = '#FFFF00';
|
||||
selectedColor = '#FACC15';
|
||||
selectedStyle: AnnotationStyle = 'highlight';
|
||||
private hasPreview = false;
|
||||
|
||||
highlightColors = [
|
||||
{value: '#FFFF00', label: 'Yellow'},
|
||||
{value: '#90EE90', label: 'Green'},
|
||||
{value: '#87CEEB', label: 'Blue'},
|
||||
{value: '#FFB6C1', label: 'Pink'},
|
||||
{value: '#FFD580', label: 'Orange'}
|
||||
{value: '#FACC15', label: 'Yellow'},
|
||||
{value: '#4ADE80', label: 'Green'},
|
||||
{value: '#38BDF8', label: 'Blue'},
|
||||
{value: '#F472B6', label: 'Pink'},
|
||||
{value: '#FB923C', label: 'Orange'}
|
||||
];
|
||||
|
||||
lineColors = [
|
||||
|
||||
@@ -9,7 +9,8 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
|
||||
private readonly HEADER_HEIGHT = 20;
|
||||
private readonly FOOTER_HEIGHT = 40;
|
||||
private readonly TRIGGER_ZONE = 40;
|
||||
private readonly HEADER_TRIGGER_ZONE = 20;
|
||||
private readonly FOOTER_TRIGGER_ZONE = 30;
|
||||
|
||||
private headerVisible = false;
|
||||
private footerVisible = false;
|
||||
@@ -54,7 +55,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
|
||||
private updateVisibility(): void {
|
||||
if (
|
||||
this.mouseY <= this.TRIGGER_ZONE ||
|
||||
this.mouseY <= this.HEADER_TRIGGER_ZONE ||
|
||||
(this.mouseY <= this.HEADER_HEIGHT && this.headerVisible) ||
|
||||
this.isPinned
|
||||
) {
|
||||
@@ -65,7 +66,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
|
||||
const footerTop = this.windowHeight - this.FOOTER_HEIGHT;
|
||||
if (
|
||||
this.mouseY >= this.windowHeight - this.TRIGGER_ZONE ||
|
||||
this.mouseY >= this.windowHeight - this.FOOTER_TRIGGER_ZONE ||
|
||||
(this.mouseY >= footerTop && this.footerVisible) ||
|
||||
this.isPinned
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user