Skip to content

Commit

Permalink
reset annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
lena.natter committed May 7, 2024
1 parent 3094ba0 commit 98fa121
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fusonic/pdf.js",
"version": "2.0.0-6-dev3",
"version": "2.0.0-6-dev4",
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
Expand Down
12 changes: 6 additions & 6 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ class LinkAnnotationElement extends AnnotationElement {
return false;
};
if (destination || destination === /* isTooltipOnly = */ "") {
this.#setInternalLink();
link.className = "internalLink";
}
}

Expand All @@ -846,7 +846,7 @@ class LinkAnnotationElement extends AnnotationElement {
this.linkService.executeNamedAction(action);
return false;
};
this.#setInternalLink();
link.className = "internalLink";
}

/**
Expand All @@ -865,7 +865,7 @@ class LinkAnnotationElement extends AnnotationElement {
);
return false;
};
this.#setInternalLink();
link.className = "internalLink";
}

/**
Expand All @@ -879,7 +879,7 @@ class LinkAnnotationElement extends AnnotationElement {
this.linkService.executeSetOCGState(action);
return false;
};
this.#setInternalLink();
link.className = "internalLink";
}

/**
Expand Down Expand Up @@ -917,15 +917,15 @@ class LinkAnnotationElement extends AnnotationElement {
if (!link.onclick) {
link.onclick = () => false;
}
this.#setInternalLink();
link.className = "internalLink";
}

_bindResetFormAction(link, resetForm) {
const otherClickAction = link.onclick;
if (!otherClickAction) {
link.href = this.linkService.getAnchorUrl("");
}
this.#setInternalLink();
link.className = "internalLink";

if (!this._fieldObjects) {
warn(
Expand Down
35 changes: 15 additions & 20 deletions web/pdf_presentation_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,28 +236,23 @@ class PDFPresentationMode {
evt.preventDefault();
return;
}
if (evt.button !== 0) {
return;
}
// Enable clicking of links in presentation mode. Note: only links
// pointing to destinations in the current PDF document work.
if (
evt.target.href &&
evt.target.parentNode?.hasAttribute("data-internal-link")
) {
return;
}
// Unless an internal link was clicked, advance one page.

//Custom behaviour do not change page on click
// evt.preventDefault();

if (evt.button === 0) {
// Enable clicking of links in presentation mode. Note: only links
// pointing to destinations in the current PDF document work.
const isInternalLink =
evt.target.href && evt.target.classList.contains("internalLink");
if (!isInternalLink) {
// Unless an internal link was clicked, advance one page.
evt.preventDefault();

// if (evt.shiftKey) {
// this.pdfViewer.previousPage();
// } else {
// this.pdfViewer.nextPage();
// }
if (evt.shiftKey) {
this.pdfViewer.previousPage();
} else {
this.pdfViewer.nextPage();
}
}
}
}

#contextMenu() {
Expand Down
4 changes: 2 additions & 2 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ body {
user-select: none;
}

.pdfPresentationMode:fullscreen section:not([data-internal-link]) {
pointer-events: none;
.pdfPresentationMode:fullscreen a:not(.internalLink) {
display: none;
}

.pdfPresentationMode:fullscreen .textLayer span {
Expand Down

0 comments on commit 98fa121

Please sign in to comment.