Skip to content

Commit

Permalink
fixes issue which caused text to stay scrambled when switching betwee…
Browse files Browse the repository at this point in the history
…n paginated and scroll mode
  • Loading branch information
aferditamuriqi committed Jan 31, 2024
1 parent fb33796 commit 47df832
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/modules/protection/ContentProtectionModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ export class ContentProtectionModule implements ReaderModule {
this.toggleRect(rect, this.securityContainer, this.isHacked)
);
}
handleResize() {
async handleResize() {
if (this.properties?.enableObfuscation) {
const onDoResize = debounce(() => {
this.calcRects(this.rects);
Expand All @@ -946,7 +946,7 @@ export class ContentProtectionModule implements ReaderModule {
this.toggleRect(rect, this.securityContainer, this.isHacked)
);
}
}, 10);
}, 50);
if (this.rects) {
this.observe();
onDoResize();
Expand Down Expand Up @@ -1126,8 +1126,8 @@ export class ContentProtectionModule implements ReaderModule {
}
return true;
}
copyToClipboard(textToClipboard) {
textToClipboard = textToClipboard.substring(
copyToClipboard(textToClipboard: string | undefined) {
textToClipboard = textToClipboard?.substring(
0,
this.properties?.charactersToCopy ?? 0
);
Expand Down
11 changes: 6 additions & 5 deletions src/navigator/IFrameNavigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2646,7 +2646,11 @@ export class IFrameNavigator extends EventEmitter implements Navigator {
if (oldPosition) {
this.view?.goToProgression(oldPosition);
}
await this.updatePositionInfo(false);
this.updatePositionInfo(false);

if (this.contentProtectionModule !== undefined) {
await this.contentProtectionModule.handleResize();
}

if (this.annotationModule !== undefined) {
await this.annotationModule.handleResize();
Expand All @@ -2663,14 +2667,11 @@ export class IFrameNavigator extends EventEmitter implements Navigator {
if (this.pageBreakModule !== undefined) {
await this.pageBreakModule.handleResize();
}
if (this.contentProtectionModule !== undefined) {
this.contentProtectionModule.handleResize();
}
if (this.lineFocusModule !== undefined) {
this.lineFocusModule.handleResize();
}
if (this.historyModule !== undefined) {
this.historyModule.handleResize();
await this.historyModule.handleResize();
}
}, 150);
}
Expand Down

0 comments on commit 47df832

Please sign in to comment.