Skip to content

Commit

Permalink
annotationEditorMode
Browse files Browse the repository at this point in the history
  • Loading branch information
lena.natter committed May 7, 2024
1 parent 98fa121 commit 94915d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 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-dev4",
"version": "2.0.0-6-dev5",
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
Expand Down
17 changes: 0 additions & 17 deletions web/pdf_presentation_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
/** @typedef {import("./event_utils.js").EventBus} EventBus */
/** @typedef {import("./pdf_viewer.js").PDFViewer} PDFViewer */


import {
normalizeWheelEventDelta,
PresentationModeState,
Expand Down Expand Up @@ -88,9 +87,7 @@ class PDFPresentationMode {
scaleValue: pdfViewer.currentScaleValue,
scrollMode: pdfViewer.scrollMode,
spreadMode: null,
annotationEditorMode: null,
};

if (
pdfViewer.spreadMode !== SpreadMode.NONE &&
!(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)
Expand All @@ -101,9 +98,6 @@ class PDFPresentationMode {
);
this.#args.spreadMode = pdfViewer.spreadMode;
}
if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {
this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;
}

try {
await promise;
Expand Down Expand Up @@ -181,12 +175,6 @@ class PDFPresentationMode {
}
this.pdfViewer.currentPageNumber = this.#args.pageNumber;
this.pdfViewer.currentScaleValue = "page-fit";

if (this.#args.annotationEditorMode !== null) {
this.pdfViewer.annotationEditorMode = {
mode: AnnotationEditorType.NONE,
};
}
}, 0);

this.#addWindowListeners();
Expand Down Expand Up @@ -216,11 +204,6 @@ class PDFPresentationMode {
this.pdfViewer.currentScaleValue = this.#args.scaleValue;
this.pdfViewer.currentPageNumber = pageNumber;

if (this.#args.annotationEditorMode !== null) {
this.pdfViewer.annotationEditorMode = {
mode: this.#args.annotationEditorMode,
};
}
this.#args = null;
}, 0);

Expand Down
31 changes: 15 additions & 16 deletions web/pdf_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@ import {
shadow,
version,
} from "pdfjs-lib";
import { GenericL10n } from "web-null_l10n";
import { SimpleLinkService } from "./pdf_link_service.js";
import { PDFPageView } from "./pdf_page_view.js";
import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
import {
DEFAULT_SCALE,
DEFAULT_SCALE_DELTA,
DEFAULT_SCALE_VALUE,
docStyle,
getVisibleElements,
isPortraitOrientation,
isValidRotation,
isValidScrollMode,
isValidSpreadMode,
MAX_AUTO_SCALE,
MAX_SCALE,
MIN_SCALE,
PresentationModeState,
removeNullCharacters,
RenderingStates,
SCROLLBAR_PADDING,
scrollIntoView,
ScrollMode,
SpreadMode,
TextLayerMode,
UNKNOWN_SCALE,
VERTICAL_PADDING,
docStyle,
getVisibleElements,
isPortraitOrientation,
isValidRotation,
isValidScrollMode,
isValidSpreadMode,
removeNullCharacters,
scrollIntoView,
watchScroll,
} from "./ui_utils.js";
import { GenericL10n } from "web-null_l10n";
import { PDFPageView } from "./pdf_page_view.js";
import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
import { SimpleLinkService } from "./pdf_link_service.js";

const DEFAULT_CACHE_SIZE = 10;

Expand Down Expand Up @@ -2221,9 +2221,7 @@ class PDFViewer {
}

get annotationEditorMode() {
return this.#annotationEditorUIManager
? this.#annotationEditorMode
: AnnotationEditorType.DISABLE;
return this.#annotationEditorMode;
}

/**
Expand Down Expand Up @@ -2284,4 +2282,5 @@ class PDFViewer {
}
}

export { PagesCountLimit, PDFPageViewBuffer, PDFViewer };
export { PDFPageViewBuffer, PDFViewer, PagesCountLimit };

0 comments on commit 94915d1

Please sign in to comment.