mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-04 15:09:17 +02:00
- files_reader v1.1, now supports PDF, see CHANGELOG.md and README.md
for change information
This commit is contained in:
parent
f909cd0f1b
commit
6a0d095d45
29 changed files with 1178 additions and 366 deletions
59
files_reader/vendor/pdfjs/controllers/annotationlayer_controller.js
vendored
Normal file
59
files_reader/vendor/pdfjs/controllers/annotationlayer_controller.js
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
PDFJS.Reader.AnnotationLayerController = function (options, reader) {
|
||||
|
||||
this.reader = reader;
|
||||
this.annotationDiv = options.annotationDiv;
|
||||
this.pdfPage = options.pdfPage;
|
||||
this.renderInteractiveForms = options.renderInteractiveForms;
|
||||
this.linkService = options.linkService;
|
||||
this.downloadManager = options.downloadManager;
|
||||
|
||||
this.div = null;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
PDFJS.Reader.AnnotationLayerController.prototype.render = function (viewport, intent) {
|
||||
var self = this;
|
||||
var parameters = {
|
||||
intent: (intent === undefined ? 'display' : intent),
|
||||
};
|
||||
|
||||
this.pdfPage.getAnnotations(parameters).then(function (annotations) {
|
||||
viewport = viewport.clone({ dontFlip: true });
|
||||
parameters = {
|
||||
viewport: viewport,
|
||||
div: self.div,
|
||||
annotations: annotations,
|
||||
page: self.pdfPage,
|
||||
renderInteractiveForms: self.renderInteractiveForms,
|
||||
linkService: self.linkService,
|
||||
downloadManager: self.downloadManager,
|
||||
};
|
||||
|
||||
if (self.div) {
|
||||
// If an annotationLayer already exists, refresh its children's
|
||||
// transformation matrices.
|
||||
PDFJS.AnnotationLayer.update(parameters);
|
||||
} else {
|
||||
// Create an annotation layer div and render the annotations
|
||||
// if there is at least one annotation.
|
||||
if (annotations.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.div = self.annotationDiv;
|
||||
parameters.div = self.div;
|
||||
|
||||
PDFJS.AnnotationLayer.render(parameters);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
PDFJS.Reader.AnnotationLayerController.prototype.hide = function () {
|
||||
|
||||
if (!this.div) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.div.setAttribute('hidden', 'true');
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue