'this'-Schlüsselwort in 'Annotation' durch 'Annotation' ersetzt, da dieser Schlüsselwort statisch ist.

This commit is contained in:
Developer 02 2024-06-18 19:11:07 +02:00
parent 95958f2a1d
commit 56df8234c7
2 changed files with 10 additions and 12 deletions

View File

@ -3,7 +3,7 @@
const annotations = [] const annotations = []
document.elements.forEach((element) => { document.elements.forEach((element) => {
const [annotation, formField] = this.createAnnotationFromElement(element) const [annotation, formField] = Annotation.createAnnotationFromElement(element)
annotations.push(annotation) annotations.push(annotation)
annotations.push(formField) annotations.push(formField)
}) })
@ -24,14 +24,14 @@
} }
static async deleteAnnotations(instance) { static async deleteAnnotations(instance) {
const allAnnotations = await this.getAnnotations(instance) const allAnnotations = await Annotation.getAnnotations(instance)
const pageAnnotations = allAnnotations.filter(this.isSignature) const pageAnnotations = allAnnotations.filter(Annotation.isSignature)
//deleting all Annotations //deleting all Annotations
return await instance.delete(pageAnnotations) return await instance.delete(pageAnnotations)
} }
static async validateAnnotations(instance) { static async validateAnnotations(instance) {
const allAnnotations = await this.getAnnotations(instance) const allAnnotations = await Annotation.getAnnotations(instance)
const pageAnnotations = allAnnotations const pageAnnotations = allAnnotations
.map((annotation) => { .map((annotation) => {
return annotation return annotation
@ -46,12 +46,12 @@
static createAnnotationFromElement(element) { static createAnnotationFromElement(element) {
const id = PSPDFKit.generateInstantId() const id = PSPDFKit.generateInstantId()
const width = this.inchToPoint(element.width) const width = Annotation.inchToPoint(element.width)
const height = this.inchToPoint(element.height) const height = Annotation.inchToPoint(element.height)
const top = this.inchToPoint(element.top) - height / 2 const top = Annotation.inchToPoint(element.top) - height / 2
const left = this.inchToPoint(element.left) - width / 2 const left = Annotation.inchToPoint(element.left) - width / 2
const page = element.page - 1 const page = element.page - 1
const annotation = this.createSignatureAnnotation( const annotation = Annotation.createSignatureAnnotation(
id, id,
width, width,
height, height,

View File

@ -70,9 +70,7 @@ class App {
// Load annotations into PSPDFKit // Load annotations into PSPDFKit
try { try {
this.signatureCount = this.currentDocument.elements.length this.signatureCount = this.currentDocument.elements.length
const annotations = Annotation.createAnnotations( const annotations = Annotation.createAnnotations(this.currentDocument)
this.currentDocument
)
await this.Instance.create(annotations) await this.Instance.create(annotations)
const openResponse = await this.Network.openDocument(this.envelopeKey) const openResponse = await this.Network.openDocument(this.envelopeKey)