Skip to content

Commit 8d453da

Browse files
committed
perf: remove renderAnnotation
1 parent 3aed098 commit 8d453da

2 files changed

Lines changed: 2 additions & 30 deletions

File tree

components/pdf-container/plugin-annotation-2/lib/custom-types.d.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PdfAnnotationObject, PdfRenderPageAnnotationOptions } from "@embedpdf/models"
1+
import type { PdfAnnotationObject } from "@embedpdf/models"
22

33
export type AnnotationEvent =
44
| {
@@ -24,12 +24,6 @@ export interface TrackedAnnotation<T extends PdfAnnotationObject = PdfAnnotation
2424
object: T
2525
}
2626

27-
export interface RenderAnnotationOptions {
28-
pageIndex: number
29-
annotation: PdfAnnotationObject
30-
options?: PdfRenderPageAnnotationOptions
31-
}
32-
3327
export interface GetPageAnnotationsOptions {
3428
pageIndex: number
3529
}

components/pdf-container/plugin-annotation-2/lib/plugin.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ import {
3535
setAnnotations,
3636
setToolDefaults,
3737
} from "./actions"
38-
import type {
39-
AnnotationEvent,
40-
GetPageAnnotationsOptions,
41-
RenderAnnotationOptions,
42-
TrackedAnnotation,
43-
} from "./custom-types"
38+
import type { AnnotationEvent, GetPageAnnotationsOptions, TrackedAnnotation } from "./custom-types"
4439
import { getSelectedAnnotation } from "./selectors"
4540
import type { AnnotationState } from "./state"
4641
import type { AnnotationTool } from "./tools/annotation-tool"
@@ -85,7 +80,6 @@ export interface AnnotationCapability {
8580
annotationId: string,
8681
patch: Partial<PdfAnnotationObject>,
8782
) => void
88-
renderAnnotation: (options: RenderAnnotationOptions) => Task<Blob, PdfErrorReason>
8983
}
9084

9185
// ***PLUGIN CLASS***
@@ -211,7 +205,6 @@ export class AnnotationPlugin extends BasePlugin<
211205
createAnnotation: (pageIndex, anno) => this.createAnnotation(pageIndex, anno),
212206
deleteAnnotation: (pageIndex, id) => this.deleteAnnotation(pageIndex, id),
213207
updateAnnotation: (pageIndex, id, patch) => this.updateAnnotation(pageIndex, id, patch),
214-
renderAnnotation: (options) => this.renderAnnotation(options),
215208
exportAnnotationsToJSON: () => this.exportAnnotationsToJSON(),
216209
}
217210
}
@@ -264,21 +257,6 @@ export class AnnotationPlugin extends BasePlugin<
264257
return this.engine.getPageAnnotations(doc, page)
265258
}
266259

267-
private renderAnnotation({ pageIndex, annotation, options }: RenderAnnotationOptions) {
268-
const coreState = this.coreState.core
269-
270-
if (!coreState.document) {
271-
return PdfTaskHelper.reject({ code: PdfErrorCode.NotFound, message: "Document not found" })
272-
}
273-
274-
const page = coreState.document.pages.find((page) => page.index === pageIndex)
275-
if (!page) {
276-
return PdfTaskHelper.reject({ code: PdfErrorCode.NotFound, message: "Page not found" })
277-
}
278-
279-
return this.engine.renderPageAnnotation(coreState.document, page, annotation, options)
280-
}
281-
282260
private importAnnotations(items: PdfAnnotationObject[]) {
283261
// If initial load hasn't completed, queue the items
284262
if (!this.isInitialLoadComplete) {

0 commit comments

Comments
 (0)