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:
Samuel Chantaraud 2014-03-07 10:48:42 -04:00
parent 3e931048f2
commit 076b3433b4
8 changed files with 305 additions and 131 deletions

View file

@ -306,10 +306,13 @@ var PageView = function pageView(container, id, scale,
CustomStyle.setProp('transformOrigin', element, transformOriginStr);
if (data.subtype === 'Link' && !data.url) {
if (data.action) {
bindNamedAction(element, data.action);
} else {
bindLink(element, ('dest' in data) ? data.dest : null);
var link = element.getElementsByTagName('a')[0];
if (link) {
if (data.action) {
bindNamedAction(link, data.action);
} else {
bindLink(link, ('dest' in data) ? data.dest : null);
}
}
}
@ -579,6 +582,7 @@ var PageView = function pageView(container, id, scale,
canvasContext: ctx,
viewport: this.viewport,
textLayer: textLayer,
// intent: 'default', // === 'display'
continueCallback: function pdfViewcContinueCallback(cont) {
if (PDFView.highestPriorityPage !== 'page' + self.id) {
self.renderingState = RenderingStates.PAUSED;
@ -650,13 +654,13 @@ var PageView = function pageView(container, id, scale,
var renderContext = {
canvasContext: ctx,
viewport: viewport
viewport: viewport,
intent: 'print'
};
pdfPage.render(renderContext).promise.then(function() {
// Tell the printEngine that rendering this canvas/page has finished.
obj.done();
self.pdfPage.destroy();
}, function(error) {
console.error(error);
// Tell the printEngine that rendering this canvas/page has failed.
@ -666,7 +670,6 @@ var PageView = function pageView(container, id, scale,
} else {
obj.done();
}
self.pdfPage.destroy();
});
};
};