Merge pull request #15089 from calixteman/editor_overlap
Correctly order added annotations when saving or printing
This commit is contained in:
commit
eace7e4c63
@ -245,9 +245,9 @@ class AnnotationFactory {
|
|||||||
static async saveNewAnnotations(evaluator, task, annotations) {
|
static async saveNewAnnotations(evaluator, task, annotations) {
|
||||||
const xref = evaluator.xref;
|
const xref = evaluator.xref;
|
||||||
let baseFontRef;
|
let baseFontRef;
|
||||||
const results = [];
|
|
||||||
const dependencies = [];
|
const dependencies = [];
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
for (const annotation of annotations) {
|
for (const annotation of annotations) {
|
||||||
switch (annotation.annotationType) {
|
switch (annotation.annotationType) {
|
||||||
case AnnotationEditorType.FREETEXT:
|
case AnnotationEditorType.FREETEXT:
|
||||||
@ -266,7 +266,6 @@ class AnnotationFactory {
|
|||||||
FreeTextAnnotation.createNewAnnotation(
|
FreeTextAnnotation.createNewAnnotation(
|
||||||
xref,
|
xref,
|
||||||
annotation,
|
annotation,
|
||||||
results,
|
|
||||||
dependencies,
|
dependencies,
|
||||||
{ evaluator, task, baseFontRef }
|
{ evaluator, task, baseFontRef }
|
||||||
)
|
)
|
||||||
@ -274,20 +273,13 @@ class AnnotationFactory {
|
|||||||
break;
|
break;
|
||||||
case AnnotationEditorType.INK:
|
case AnnotationEditorType.INK:
|
||||||
promises.push(
|
promises.push(
|
||||||
InkAnnotation.createNewAnnotation(
|
InkAnnotation.createNewAnnotation(xref, annotation, dependencies)
|
||||||
xref,
|
|
||||||
annotation,
|
|
||||||
results,
|
|
||||||
dependencies
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(promises);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
annotations: results,
|
annotations: await Promise.all(promises),
|
||||||
dependencies,
|
dependencies,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1360,13 +1352,7 @@ class MarkupAnnotation extends Annotation {
|
|||||||
this._streams.push(this.appearance, appearanceStream);
|
this._streams.push(this.appearance, appearanceStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async createNewAnnotation(
|
static async createNewAnnotation(xref, annotation, dependencies, params) {
|
||||||
xref,
|
|
||||||
annotation,
|
|
||||||
results,
|
|
||||||
dependencies,
|
|
||||||
params
|
|
||||||
) {
|
|
||||||
const annotationRef = xref.getNewRef();
|
const annotationRef = xref.getNewRef();
|
||||||
const apRef = xref.getNewRef();
|
const apRef = xref.getNewRef();
|
||||||
const annotationDict = this.createNewDict(annotation, xref, { apRef });
|
const annotationDict = this.createNewDict(annotation, xref, { apRef });
|
||||||
@ -1385,7 +1371,7 @@ class MarkupAnnotation extends Annotation {
|
|||||||
: null;
|
: null;
|
||||||
writeObject(annotationRef, annotationDict, buffer, transform);
|
writeObject(annotationRef, annotationDict, buffer, transform);
|
||||||
|
|
||||||
results.push({ ref: annotationRef, data: buffer.join("") });
|
return { ref: annotationRef, data: buffer.join("") };
|
||||||
}
|
}
|
||||||
|
|
||||||
static async createNewPrintAnnotation(xref, annotation, params) {
|
static async createNewPrintAnnotation(xref, annotation, params) {
|
||||||
|
@ -314,7 +314,6 @@ class Page {
|
|||||||
...newData.annotations
|
...newData.annotations
|
||||||
);
|
);
|
||||||
|
|
||||||
this.xref.resetNewRef();
|
|
||||||
return objects;
|
return objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6638,8 +6638,7 @@
|
|||||||
"fontSize": 10,
|
"fontSize": 10,
|
||||||
"value": "Hello World",
|
"value": "Hello World",
|
||||||
"pageIndex": 0,
|
"pageIndex": 0,
|
||||||
"rect": [67.5, 543, 119, 556.5],
|
"rect": [67.5, 543, 119, 556.5]
|
||||||
"orderIndex": 0
|
|
||||||
},
|
},
|
||||||
"pdfjs_internal_editor_1": {
|
"pdfjs_internal_editor_1": {
|
||||||
"annotationType": 15,
|
"annotationType": 15,
|
||||||
@ -6662,8 +6661,7 @@
|
|||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
"pageIndex": 0,
|
"pageIndex": 0,
|
||||||
"rect": [71.5, 534.5, 115, 562],
|
"rect": [71.5, 534.5, 115, 562]
|
||||||
"orderIndex": 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user