diff --git a/src/core/annotation.js b/src/core/annotation.js index 418058475..af7fbb7c8 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -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); diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index fc974f23c..bd7ae50ad 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -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 diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 252702f6b..e5a212cb0 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -203,3 +203,4 @@ !annotation-text-without-popup.pdf !annotation-underline.pdf !annotation-strikeout.pdf +!annotation-squiggly.pdf diff --git a/test/pdfs/annotation-squiggly.pdf b/test/pdfs/annotation-squiggly.pdf new file mode 100644 index 000000000..32655700d Binary files /dev/null and b/test/pdfs/annotation-squiggly.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 6a0c9fc96..63d537ddb 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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", diff --git a/web/annotation_layer_builder.css b/web/annotation_layer_builder.css index b48e4c691..5d5afdf1b 100644 --- a/web/annotation_layer_builder.css +++ b/web/annotation_layer_builder.css @@ -69,10 +69,8 @@ padding-top: 0.2em; } -.annotationLayer .underlineAnnotation { - cursor: pointer; -} - +.annotationLayer .underlineAnnotation, +.annotationLayer .squigglyAnnotation, .annotationLayer .strikeoutAnnotation { cursor: pointer; }