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 LONG_HOLD_THRESHOLD_MS = 500;
|
||||||
private readonly LEFT_ZONE_PERCENT = 0.3;
|
private readonly LEFT_ZONE_PERCENT = 0.3;
|
||||||
private readonly RIGHT_ZONE_PERCENT = 0.7;
|
private readonly RIGHT_ZONE_PERCENT = 0.7;
|
||||||
|
private readonly SWIPE_THRESHOLD_PX = 50;
|
||||||
|
|
||||||
private annotationService = inject(ReaderAnnotationService);
|
private annotationService = inject(ReaderAnnotationService);
|
||||||
|
|
||||||
@@ -42,6 +43,12 @@ export class ReaderEventService {
|
|||||||
private keydownHandler?: (event: KeyboardEvent) => void;
|
private keydownHandler?: (event: KeyboardEvent) => void;
|
||||||
private clickedDocs = new WeakSet<Document>();
|
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>();
|
private eventSubject = new Subject<ViewEvent>();
|
||||||
public events$ = this.eventSubject.asObservable();
|
public events$ = this.eventSubject.asObservable();
|
||||||
|
|
||||||
@@ -78,6 +85,15 @@ export class ReaderEventService {
|
|||||||
}
|
}
|
||||||
this.attachIframeEventHandlers(e.detail.doc);
|
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) => {
|
this.view.addEventListener('relocate', (e: any) => {
|
||||||
@@ -137,7 +153,183 @@ export class ReaderEventService {
|
|||||||
}, this.LONG_HOLD_THRESHOLD_MS);
|
}, this.LONG_HOLD_THRESHOLD_MS);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
doc.addEventListener('mouseup', (event: MouseEvent) => {
|
doc.addEventListener('mouseup', () => {
|
||||||
|
this.handleSelectionEnd(doc);
|
||||||
|
});
|
||||||
|
|
||||||
|
doc.addEventListener('click', (event: MouseEvent) => {
|
||||||
|
const iframe = doc.defaultView?.frameElement as HTMLIFrameElement | null;
|
||||||
|
if (!iframe) return;
|
||||||
|
|
||||||
|
const iframeRect = iframe.getBoundingClientRect();
|
||||||
|
const viewportX = iframeRect.left + event.clientX;
|
||||||
|
const viewportY = iframeRect.top + event.clientY;
|
||||||
|
|
||||||
|
window.postMessage({
|
||||||
|
type: 'iframe-click',
|
||||||
|
clientX: viewportX,
|
||||||
|
clientY: viewportY,
|
||||||
|
iframeLeft: iframeRect.left,
|
||||||
|
iframeWidth: iframeRect.width,
|
||||||
|
eventClientX: event.clientX,
|
||||||
|
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(() => {
|
setTimeout(() => {
|
||||||
const selection = doc.defaultView?.getSelection();
|
const selection = doc.defaultView?.getSelection();
|
||||||
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
||||||
@@ -187,26 +379,6 @@ export class ReaderEventService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
});
|
|
||||||
|
|
||||||
doc.addEventListener('click', (event: MouseEvent) => {
|
|
||||||
const iframe = doc.defaultView?.frameElement as HTMLIFrameElement | null;
|
|
||||||
if (!iframe) return;
|
|
||||||
|
|
||||||
const iframeRect = iframe.getBoundingClientRect();
|
|
||||||
const viewportX = iframeRect.left + event.clientX;
|
|
||||||
const viewportY = iframeRect.top + event.clientY;
|
|
||||||
|
|
||||||
window.postMessage({
|
|
||||||
type: 'iframe-click',
|
|
||||||
clientX: viewportX,
|
|
||||||
clientY: viewportY,
|
|
||||||
iframeLeft: iframeRect.left,
|
|
||||||
iframeWidth: iframeRect.width,
|
|
||||||
eventClientX: event.clientX,
|
|
||||||
target: (event.target as HTMLElement)?.tagName
|
|
||||||
}, '*');
|
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleIframeClickMessage(data: any): void {
|
private handleIframeClickMessage(data: any): void {
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ export class ReaderViewManagerService {
|
|||||||
|
|
||||||
destroy(): void {
|
destroy(): void {
|
||||||
this.eventService.destroy();
|
this.eventService.destroy();
|
||||||
this.annotationService.clearAnnotations();
|
|
||||||
this.view?.remove();
|
this.view?.remove();
|
||||||
this.view = null;
|
this.view = null;
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-3
@@ -15,15 +15,23 @@ export interface Annotation {
|
|||||||
})
|
})
|
||||||
export class ReaderAnnotationService {
|
export class ReaderAnnotationService {
|
||||||
private annotationStyles = new Map<string, { color: string; style: AnnotationStyle }>();
|
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);
|
if (!view) return of(undefined);
|
||||||
|
|
||||||
const style = annotation.style || 'highlight';
|
const style = annotation.style || 'highlight';
|
||||||
const color = annotation.color || '#FFFF00';
|
const color = annotation.color || '#FACC15';
|
||||||
|
|
||||||
this.annotationStyles.set(annotation.value, {color, style});
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
return defer(() => from(view.addAnnotation({value: annotation.value}) as Promise<{ index: number; label: string } | undefined>));
|
return defer(() => from(view.addAnnotation({value: annotation.value}) as Promise<{ index: number; label: string } | undefined>));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +39,7 @@ export class ReaderAnnotationService {
|
|||||||
if (!view) return of(undefined);
|
if (!view) return of(undefined);
|
||||||
|
|
||||||
this.annotationStyles.delete(cfi);
|
this.annotationStyles.delete(cfi);
|
||||||
|
this.allAnnotations = this.allAnnotations.filter(a => a.value !== cfi);
|
||||||
|
|
||||||
return defer(() => from(view.deleteAnnotation({value: cfi}) as Promise<void>));
|
return defer(() => from(view.deleteAnnotation({value: cfi}) as Promise<void>));
|
||||||
}
|
}
|
||||||
@@ -44,8 +53,16 @@ export class ReaderAnnotationService {
|
|||||||
addAnnotations(view: any, annotations: Annotation[]): void {
|
addAnnotations(view: any, annotations: Annotation[]): void {
|
||||||
annotations.forEach(annotation => {
|
annotations.forEach(annotation => {
|
||||||
const style = annotation.style || 'highlight';
|
const style = annotation.style || 'highlight';
|
||||||
const color = annotation.color || '#FFFF00';
|
const color = annotation.color || '#FACC15';
|
||||||
this.annotationStyles.set(annotation.value, {color, style});
|
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});
|
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.annotationStyles.clear();
|
||||||
|
this.allAnnotations = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -8,12 +8,13 @@ import {
|
|||||||
AnnotationStyle,
|
AnnotationStyle,
|
||||||
CreateAnnotationRequest
|
CreateAnnotationRequest
|
||||||
} from '../../../../../shared/service/annotation.service';
|
} from '../../../../../shared/service/annotation.service';
|
||||||
import {Annotation as ViewAnnotation} from './annotation-renderer.service';
|
import {Annotation as ViewAnnotation, ReaderAnnotationService} from './annotation-renderer.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ReaderAnnotationHttpService {
|
export class ReaderAnnotationHttpService {
|
||||||
private annotationService = inject(AnnotationService);
|
private annotationService = inject(AnnotationService);
|
||||||
private messageService = inject(MessageService);
|
private messageService = inject(MessageService);
|
||||||
|
private readerAnnotationService = inject(ReaderAnnotationService);
|
||||||
|
|
||||||
private currentChapterTitle: string | null = null;
|
private currentChapterTitle: string | null = null;
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ export class ReaderAnnotationHttpService {
|
|||||||
bookId: number,
|
bookId: number,
|
||||||
cfi: string,
|
cfi: string,
|
||||||
text: string,
|
text: string,
|
||||||
color: string = '#FFFF00',
|
color: string = '#FACC15',
|
||||||
style: AnnotationStyle = 'highlight',
|
style: AnnotationStyle = 'highlight',
|
||||||
note?: string
|
note?: string
|
||||||
): Observable<Annotation | null> {
|
): Observable<Annotation | null> {
|
||||||
@@ -126,5 +127,6 @@ export class ReaderAnnotationHttpService {
|
|||||||
|
|
||||||
reset(): void {
|
reset(): void {
|
||||||
this.currentChapterTitle = null;
|
this.currentChapterTitle = null;
|
||||||
|
this.readerAnnotationService.resetAnnotations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-9
@@ -1,11 +1,7 @@
|
|||||||
<div class="dialog-overlay" (click)="onOverlayClick($event)">
|
<div class="quick-settings-overlay" (click)="onOverlayClick()">
|
||||||
<div class="dialog" (click)="$event.stopPropagation()">
|
<div class="quick-settings-panel" (click)="$event.stopPropagation()">
|
||||||
<div class="dialog-header">
|
<div class="pointer"></div>
|
||||||
<h3 class="dialog-title">Quick Settings</h3>
|
<div class="panel-body">
|
||||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dialog-body">
|
|
||||||
<!-- Dark Mode -->
|
<!-- Dark Mode -->
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<label>Dark Mode</label>
|
<label>Dark Mode</label>
|
||||||
@@ -43,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-footer">
|
<div class="panel-footer">
|
||||||
<button class="more-settings-btn" (click)="onOpenFullSettings()">
|
<button class="more-settings-btn" (click)="onOpenFullSettings()">
|
||||||
<app-reader-icon name="settings" [size]="16"></app-reader-icon>
|
<app-reader-icon name="settings" [size]="16"></app-reader-icon>
|
||||||
<span>More Settings</span>
|
<span>More Settings</span>
|
||||||
|
|||||||
+25
-45
@@ -1,5 +1,5 @@
|
|||||||
// Variables matching sidebar/dialog styling
|
// Variables matching sidebar/dialog styling
|
||||||
$dialog-bg: #1a1a1a;
|
$panel-bg: #1a1a1a;
|
||||||
$text-primary: rgba(255, 255, 255, 0.95);
|
$text-primary: rgba(255, 255, 255, 0.95);
|
||||||
$text-secondary: rgba(255, 255, 255, 0.6);
|
$text-secondary: rgba(255, 255, 255, 0.6);
|
||||||
$text-muted: rgba(255, 255, 255, 0.4);
|
$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-fast: 150ms ease;
|
||||||
$transition-normal: 200ms ease;
|
$transition-normal: 200ms ease;
|
||||||
|
|
||||||
.dialog-overlay {
|
.quick-settings-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
z-index: 12000;
|
z-index: 12000;
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
animation: fadeIn $transition-normal;
|
animation: fadeIn $transition-normal;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
@@ -22,17 +24,18 @@ $transition-normal: 200ms ease;
|
|||||||
to { opacity: 1; }
|
to { opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog {
|
.quick-settings-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 44px;
|
top: 52px;
|
||||||
right: 24px;
|
right: 60px;
|
||||||
width: 280px;
|
width: 280px;
|
||||||
background: $dialog-bg;
|
background: $panel-bg;
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
|
||||||
animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideDown {
|
@keyframes slideDown {
|
||||||
@@ -46,45 +49,21 @@ $transition-normal: 200ms ease;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-header {
|
// Pointer arrow
|
||||||
display: flex;
|
.pointer {
|
||||||
align-items: center;
|
position: absolute;
|
||||||
justify-content: space-between;
|
top: -8px;
|
||||||
padding: 14px 16px;
|
right: 18px;
|
||||||
border-bottom: 1px solid $border-color;
|
width: 16px;
|
||||||
background: rgba(0, 0, 0, 0.2);
|
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 {
|
.panel-body {
|
||||||
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 {
|
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,10 +206,11 @@ $transition-normal: 200ms ease;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer {
|
.panel-footer {
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border-top: 1px solid $border-color;
|
border-top: 1px solid $border-color;
|
||||||
background: rgba(0, 0, 0, 0.15);
|
background: rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 0 0 12px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-settings-btn {
|
.more-settings-btn {
|
||||||
|
|||||||
+1
-3
@@ -76,9 +76,7 @@ export class ReaderQuickSettingsComponent {
|
|||||||
this.openFullSettings.emit();
|
this.openFullSettings.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
onOverlayClick(event: MouseEvent): void {
|
onOverlayClick(): void {
|
||||||
if ((event.target as HTMLElement).classList.contains('quick-settings-overlay')) {
|
|
||||||
this.close.emit();
|
this.close.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ export class ReaderIconComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLineCoords(d: string, index: number): string {
|
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,]+/);
|
const coords = d.replace(/[ML]/g, ' ').trim().split(/[\s,]+/);
|
||||||
return coords[index] || '0';
|
return coords[index] || '0';
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -39,16 +39,16 @@ export class TextSelectionPopupComponent {
|
|||||||
@Output() action = new EventEmitter<TextSelectionAction>();
|
@Output() action = new EventEmitter<TextSelectionAction>();
|
||||||
|
|
||||||
showAnnotationOptions = false;
|
showAnnotationOptions = false;
|
||||||
selectedColor = '#FFFF00';
|
selectedColor = '#FACC15';
|
||||||
selectedStyle: AnnotationStyle = 'highlight';
|
selectedStyle: AnnotationStyle = 'highlight';
|
||||||
private hasPreview = false;
|
private hasPreview = false;
|
||||||
|
|
||||||
highlightColors = [
|
highlightColors = [
|
||||||
{value: '#FFFF00', label: 'Yellow'},
|
{value: '#FACC15', label: 'Yellow'},
|
||||||
{value: '#90EE90', label: 'Green'},
|
{value: '#4ADE80', label: 'Green'},
|
||||||
{value: '#87CEEB', label: 'Blue'},
|
{value: '#38BDF8', label: 'Blue'},
|
||||||
{value: '#FFB6C1', label: 'Pink'},
|
{value: '#F472B6', label: 'Pink'},
|
||||||
{value: '#FFD580', label: 'Orange'}
|
{value: '#FB923C', label: 'Orange'}
|
||||||
];
|
];
|
||||||
|
|
||||||
lineColors = [
|
lineColors = [
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
|
|
||||||
private readonly HEADER_HEIGHT = 20;
|
private readonly HEADER_HEIGHT = 20;
|
||||||
private readonly FOOTER_HEIGHT = 40;
|
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 headerVisible = false;
|
||||||
private footerVisible = false;
|
private footerVisible = false;
|
||||||
@@ -54,7 +55,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
|
|
||||||
private updateVisibility(): void {
|
private updateVisibility(): void {
|
||||||
if (
|
if (
|
||||||
this.mouseY <= this.TRIGGER_ZONE ||
|
this.mouseY <= this.HEADER_TRIGGER_ZONE ||
|
||||||
(this.mouseY <= this.HEADER_HEIGHT && this.headerVisible) ||
|
(this.mouseY <= this.HEADER_HEIGHT && this.headerVisible) ||
|
||||||
this.isPinned
|
this.isPinned
|
||||||
) {
|
) {
|
||||||
@@ -65,7 +66,7 @@ export class ReaderHeaderFooterVisibilityManager {
|
|||||||
|
|
||||||
const footerTop = this.windowHeight - this.FOOTER_HEIGHT;
|
const footerTop = this.windowHeight - this.FOOTER_HEIGHT;
|
||||||
if (
|
if (
|
||||||
this.mouseY >= this.windowHeight - this.TRIGGER_ZONE ||
|
this.mouseY >= this.windowHeight - this.FOOTER_TRIGGER_ZONE ||
|
||||||
(this.mouseY >= footerTop && this.footerVisible) ||
|
(this.mouseY >= footerTop && this.footerVisible) ||
|
||||||
this.isPinned
|
this.isPinned
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user