mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 01:28:06 +02:00
Improved annotations' display/behavior.
Added an "InteractiveAnnotation" class to homogenize the annotations' structure (highlighting) and user interactions (for now, used for text and link annotations). Text annotations: The appearance (AP) has priority over the icon (Name). The popup extends horizontally (up to a limit) as well as vertically. Reduced the title's font size. The annotation's color (C) is used to color the popup's background. On top of the mouseover show/hide behavior, a click on the icon will lock the annotation open (for mobile purposes). It can be closed with another click on either the icon or the popup. An annotation printing is conditioned by its "print" bit Unsupported annotations are not displayed at all.
This commit is contained in:
parent
3e931048f2
commit
076b3433b4
8 changed files with 305 additions and 131 deletions
|
@ -134,7 +134,7 @@ var Page = (function PageClosure() {
|
|||
}.bind(this));
|
||||
return promise;
|
||||
},
|
||||
getOperatorList: function Page_getOperatorList(handler) {
|
||||
getOperatorList: function Page_getOperatorList(handler, intent) {
|
||||
var self = this;
|
||||
var promise = new LegacyPromise();
|
||||
|
||||
|
@ -169,11 +169,12 @@ var Page = (function PageClosure() {
|
|||
var contentStream = data[0];
|
||||
|
||||
|
||||
var opList = new OperatorList(handler, self.pageIndex);
|
||||
var opList = new OperatorList(intent, handler, self.pageIndex);
|
||||
|
||||
handler.send('StartRenderPage', {
|
||||
transparency: partialEvaluator.hasBlendModes(self.resources),
|
||||
pageIndex: self.pageIndex
|
||||
pageIndex: self.pageIndex,
|
||||
intent: intent
|
||||
});
|
||||
partialEvaluator.getOperatorList(contentStream, self.resources, opList);
|
||||
pageListPromise.resolve(opList);
|
||||
|
@ -191,7 +192,7 @@ var Page = (function PageClosure() {
|
|||
}
|
||||
|
||||
var annotationsReadyPromise = Annotation.appendToOperatorList(
|
||||
annotations, pageOpList, pdfManager, partialEvaluator);
|
||||
annotations, pageOpList, pdfManager, partialEvaluator, intent);
|
||||
annotationsReadyPromise.then(function () {
|
||||
pageOpList.flush(true);
|
||||
promise.resolve(pageOpList);
|
||||
|
|
|
@ -1376,7 +1376,7 @@ var OperatorList = (function OperatorListClosure() {
|
|||
}
|
||||
|
||||
|
||||
function OperatorList(messageHandler, pageIndex) {
|
||||
function OperatorList(intent, messageHandler, pageIndex) {
|
||||
this.messageHandler = messageHandler;
|
||||
// When there isn't a message handler the fn array needs to be able to grow
|
||||
// since we can't flush the operators.
|
||||
|
@ -1389,6 +1389,7 @@ var OperatorList = (function OperatorListClosure() {
|
|||
this.dependencies = {};
|
||||
this.pageIndex = pageIndex;
|
||||
this.fnIndex = 0;
|
||||
this.intent = intent;
|
||||
}
|
||||
|
||||
OperatorList.prototype = {
|
||||
|
@ -1449,7 +1450,8 @@ var OperatorList = (function OperatorListClosure() {
|
|||
lastChunk: lastChunk,
|
||||
length: this.length
|
||||
},
|
||||
pageIndex: this.pageIndex
|
||||
pageIndex: this.pageIndex,
|
||||
intent: this.intent
|
||||
}, null, transfers);
|
||||
this.dependencies = [];
|
||||
this.fnIndex = 0;
|
||||
|
|
|
@ -334,7 +334,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
var pageNum = data.pageIndex + 1;
|
||||
var start = Date.now();
|
||||
// Pre compile the pdf page and fetch the fonts/images.
|
||||
page.getOperatorList(handler).then(function(operatorList) {
|
||||
page.getOperatorList(handler, data.intent).then(function(operatorList) {
|
||||
|
||||
info('page=' + pageNum + ' - getOperatorList: time=' +
|
||||
(Date.now() - start) + 'ms, len=' + operatorList.fnArray.length);
|
||||
|
@ -366,7 +366,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||
|
||||
handler.send('PageError', {
|
||||
pageNum: pageNum,
|
||||
error: wrappedException
|
||||
error: wrappedException,
|
||||
intent: data.intent
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue