Merge pull request #6232 from timvandermeij/annotations-data-passing

Simplify annotation data passing
This commit is contained in:
Jonas Jenwald 2015-07-19 18:11:47 +02:00
commit d3e90cf825
3 changed files with 5 additions and 17 deletions

View File

@ -175,10 +175,6 @@ var Annotation = (function AnnotationClosure() {
} }
}, },
getData: function Annotation_getData() {
return this.data;
},
isInvisible: function Annotation_isInvisible() { isInvisible: function Annotation_isInvisible() {
var data = this.data; var data = this.data;
if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) { if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) {

View File

@ -111,11 +111,6 @@ var Page = (function PageClosure() {
return shadow(this, 'view', cropBox); return shadow(this, 'view', cropBox);
}, },
get annotationRefs() {
return shadow(this, 'annotationRefs',
this.getInheritedPageProp('Annots'));
},
get rotate() { get rotate() {
var rotate = this.getInheritedPageProp('Rotate') || 0; var rotate = this.getInheritedPageProp('Rotate') || 0;
// Normalize rotation so it's a multiple of 90 and between 0 and 270 // Normalize rotation so it's a multiple of 90 and between 0 and 270
@ -261,14 +256,14 @@ var Page = (function PageClosure() {
var annotations = this.annotations; var annotations = this.annotations;
var annotationsData = []; var annotationsData = [];
for (var i = 0, n = annotations.length; i < n; ++i) { for (var i = 0, n = annotations.length; i < n; ++i) {
annotationsData.push(annotations[i].getData()); annotationsData.push(annotations[i].data);
} }
return annotationsData; return annotationsData;
}, },
get annotations() { get annotations() {
var annotations = []; var annotations = [];
var annotationRefs = (this.annotationRefs || []); var annotationRefs = this.getInheritedPageProp('Annots') || [];
for (var i = 0, n = annotationRefs.length; i < n; ++i) { for (var i = 0, n = annotationRefs.length; i < n; ++i) {
var annotationRef = annotationRefs[i]; var annotationRef = annotationRefs[i];
var annotation = Annotation.fromRef(this.xref, annotationRef); var annotation = Annotation.fromRef(this.xref, annotationRef);

View File

@ -688,13 +688,10 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
* annotation objects. * annotation objects.
*/ */
getAnnotations: function PDFPageProxy_getAnnotations() { getAnnotations: function PDFPageProxy_getAnnotations() {
if (this.annotationsPromise) { if (!this.annotationsPromise) {
return this.annotationsPromise; this.annotationsPromise = this.transport.getAnnotations(this.pageIndex);
} }
return this.annotationsPromise;
var promise = this.transport.getAnnotations(this.pageIndex);
this.annotationsPromise = promise;
return promise;
}, },
/** /**
* Begins the process of rendering a page to the desired context. * Begins the process of rendering a page to the desired context.