feat(reader): add document mode to the PDF viewer, overhaul PDF viewer, add different modes to CBX viewer (#306)
* feat(reader): add document mode to the PDF viewer, overhaul PDF viewer, add different modes to CBX viewer * feat(reader): improve reader settings with brightness, emulate book mode, and click-to-paginate options * feat(reader): add long strip scroll mode and update related settings
This commit is contained in:
@@ -5,6 +5,7 @@ export interface HeaderFooterVisibilityState {
|
||||
|
||||
export class ReaderHeaderFooterVisibilityManager {
|
||||
private isPinned = false;
|
||||
private isImmersive = false;
|
||||
private mouseY: number;
|
||||
|
||||
private readonly HEADER_HEIGHT = 20;
|
||||
@@ -31,11 +32,13 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
|
||||
handleMouseMove(mouseY: number): void {
|
||||
this.mouseY = mouseY;
|
||||
this.updateVisibility();
|
||||
if (!this.isImmersive) {
|
||||
this.updateVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
handleMouseLeave(): void {
|
||||
if (!this.isPinned) {
|
||||
if (!this.isPinned && !this.isImmersive) {
|
||||
this.setHeaderVisible(false);
|
||||
this.setFooterVisible(false);
|
||||
this.notifyStateChange();
|
||||
@@ -43,14 +46,14 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
}
|
||||
|
||||
handleHeaderZoneEnter(): void {
|
||||
if (!this.isPinned) {
|
||||
if (!this.isPinned && !this.isImmersive) {
|
||||
this.setHeaderVisible(true);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
handleFooterZoneEnter(): void {
|
||||
if (!this.isPinned) {
|
||||
if (!this.isPinned && !this.isImmersive) {
|
||||
this.setFooterVisible(true);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
@@ -61,6 +64,37 @@ export class ReaderHeaderFooterVisibilityManager {
|
||||
this.updateVisibility();
|
||||
}
|
||||
|
||||
unpinIfPinned(): void {
|
||||
if (this.isPinned) {
|
||||
this.isPinned = false;
|
||||
this.updateVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
setImmersive(immersive: boolean): void {
|
||||
this.isImmersive = immersive;
|
||||
if (immersive) {
|
||||
this.isPinned = false;
|
||||
this.setHeaderVisible(false);
|
||||
this.setFooterVisible(false);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
temporaryShow(): void {
|
||||
this.setHeaderVisible(true);
|
||||
this.setFooterVisible(true);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
|
||||
hideTemporary(): void {
|
||||
if (this.isImmersive) {
|
||||
this.setHeaderVisible(false);
|
||||
this.setFooterVisible(false);
|
||||
this.notifyStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
getVisibilityState(): HeaderFooterVisibilityState {
|
||||
return {
|
||||
headerVisible: this.headerVisible,
|
||||
|
||||
Reference in New Issue
Block a user