Implement support for Squiggly annotations

This commit is contained in:
Tim van der Meij 2015-12-30 15:28:26 +01:00
parent d956177482
commit 34918a6666
6 changed files with 58 additions and 4 deletions

View File

@ -99,6 +99,9 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
case 'Underline':
return new UnderlineAnnotation(parameters);
case 'Squiggly':
return new SquigglyAnnotation(parameters);
case 'StrikeOut':
return new StrikeOutAnnotation(parameters);
@ -808,6 +811,22 @@ var UnderlineAnnotation = (function UnderlineAnnotationClosure() {
return UnderlineAnnotation;
})();
var SquigglyAnnotation = (function SquigglyAnnotationClosure() {
function SquigglyAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = AnnotationType.SQUIGGLY;
this.data.hasHtml = true;
// PDF viewers completely ignore any border styles.
this.data.borderStyle.setWidth(0);
}
Util.inherit(SquigglyAnnotation, Annotation, {});
return SquigglyAnnotation;
})();
var StrikeOutAnnotation = (function StrikeOutAnnotationClosure() {
function StrikeOutAnnotation(parameters) {
Annotation.call(this, parameters);

View File

@ -75,6 +75,9 @@ AnnotationElementFactory.prototype =
case AnnotationType.UNDERLINE:
return new UnderlineAnnotationElement(parameters);
case AnnotationType.SQUIGGLY:
return new SquigglyAnnotationElement(parameters);
case AnnotationType.STRIKEOUT:
return new StrikeOutAnnotationElement(parameters);
@ -633,6 +636,32 @@ var UnderlineAnnotationElement = (
return UnderlineAnnotationElement;
})();
/**
* @class
* @alias SquigglyAnnotationElement
*/
var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
function SquigglyAnnotationElement(parameters) {
AnnotationElement.call(this, parameters);
}
Util.inherit(SquigglyAnnotationElement, AnnotationElement, {
/**
* Render the squiggly annotation's HTML element in the empty container.
*
* @public
* @memberof SquigglyAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function SquigglyAnnotationElement_render() {
this.container.className = 'squigglyAnnotation';
return this.container;
}
});
return SquigglyAnnotationElement;
})();
/**
* @class
* @alias StrikeOutAnnotationElement

View File

@ -203,3 +203,4 @@
!annotation-text-without-popup.pdf
!annotation-underline.pdf
!annotation-strikeout.pdf
!annotation-squiggly.pdf

Binary file not shown.

View File

@ -2660,6 +2660,13 @@
"type": "eq",
"annotations": true
},
{ "id": "annotation-squiggly",
"file": "pdfs/annotation-squiggly.pdf",
"md5": "38661e731ac6c525af5894d2d20c6e71",
"rounds": 1,
"type": "eq",
"annotations": true
},
{ "id": "issue6108",
"file": "pdfs/issue6108.pdf",
"md5": "8961cb55149495989a80bf0487e0f076",

View File

@ -69,10 +69,8 @@
padding-top: 0.2em;
}
.annotationLayer .underlineAnnotation {
cursor: pointer;
}
.annotationLayer .underlineAnnotation,
.annotationLayer .squigglyAnnotation,
.annotationLayer .strikeoutAnnotation {
cursor: pointer;
}