Skip to content

Commit 17ed917

Browse files
committed
Disable scroll protection option
This is too tricky to handle right now, too many false positives when using keyboard, etc.
1 parent 40fd0aa commit 17ed917

File tree

5 files changed

+9
-18
lines changed

5 files changed

+9
-18
lines changed

navigator-html-injectables/src/modules/Peripherals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export interface ContentProtectionConfig {
129129
disableContextMenu?: boolean;
130130
disableDragAndDrop?: boolean;
131131
disableKeyboardShortcuts?: KeyboardShortcut[];
132-
enableScrollProtection?: boolean;
132+
// enableScrollProtection?: boolean;
133133
}
134134

135135
export class Peripherals extends Module {

navigator-html-injectables/src/modules/snapper/ColumnSnapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export class ColumnSnapper extends Snapper {
264264
private enableSnapProtection() {
265265
if (!this.patternAnalyzer) {
266266
this.patternAnalyzer = new PatternAnalyzer({
267-
maxVelocity: 1000, // pixels/ms (adjust based on your page width)
267+
maxVelocity: this.wnd.innerWidth, // page width
268268
minVariance: 0.1, // Allow for some variation in swipe speed
269269
historySize: 5 // Fewer samples needed for swipe detection
270270
});

navigator/src/epub/EpubNavigator.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,7 @@ export class EpubNavigator extends VisualNavigator implements Configurable<Confi
128128
allowedDomains: userConfig.allowedDomains
129129
});
130130

131-
this._contentProtection = configuration.contentProtection || {
132-
monitorSelection: true,
133-
protectCopy: true,
134-
disableContextMenu: true,
135-
disableDragAndDrop: true,
136-
disableKeyboardShortcuts: ["devTools", "selectAll", "print"],
137-
enableScrollProtection: false,
138-
checkAutomation: true,
139-
checkIFrameEmbedding: true
140-
};
131+
this._contentProtection = configuration.contentProtection || {};
141132

142133
// Initialize navigator protection if configured
143134
if (this._contentProtection.disableKeyboardShortcuts || this._contentProtection.disableContextMenu) {

navigator/src/epub/frame/FrameManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ export class FrameManager {
7171
this.comms.send("peripherals_protection", this.contentProtectionConfig);
7272

7373
// Apply scroll protection
74-
if (this.contentProtectionConfig.enableScrollProtection) {
75-
this.comms.send("scroll_protection", {});
76-
}
74+
// if (this.contentProtectionConfig.enableScrollProtection) {
75+
// this.comms.send("scroll_protection", {});
76+
// }
7777

7878
// Apply print protection if configured
7979
if (this.contentProtectionConfig.protectPrinting) {

navigator/src/webpub/WebPubFrameManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export class WebPubFrameManager {
4040
this.comms.send("peripherals_protection", this.contentProtectionConfig);
4141

4242
// Apply scroll protection if enabled
43-
if (this.contentProtectionConfig.enableScrollProtection) {
44-
this.comms.send("scroll_protection", {});
45-
}
43+
// if (this.contentProtectionConfig.enableScrollProtection) {
44+
// this.comms.send("scroll_protection", {});
45+
// }
4646

4747
// Apply print protection if configured
4848
if (this.contentProtectionConfig.protectPrinting) {

0 commit comments

Comments
 (0)