Implement support for StrikeOut annotations
This commit is contained in:
		
							parent
							
								
									b32cdf5836
								
							
						
					
					
						commit
						c5f4b9750e
					
				| @ -99,6 +99,9 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ { | ||||
|       case 'Underline': | ||||
|         return new UnderlineAnnotation(parameters); | ||||
| 
 | ||||
|       case 'StrikeOut': | ||||
|         return new StrikeOutAnnotation(parameters); | ||||
| 
 | ||||
|       default: | ||||
|         warn('Unimplemented annotation type "' + subtype + '", ' + | ||||
|              'falling back to base annotation'); | ||||
| @ -805,6 +808,22 @@ var UnderlineAnnotation = (function UnderlineAnnotationClosure() { | ||||
|   return UnderlineAnnotation; | ||||
| })(); | ||||
| 
 | ||||
| var StrikeOutAnnotation = (function StrikeOutAnnotationClosure() { | ||||
|   function StrikeOutAnnotation(parameters) { | ||||
|     Annotation.call(this, parameters); | ||||
| 
 | ||||
|     this.data.annotationType = AnnotationType.STRIKEOUT; | ||||
|     this.data.hasHtml = true; | ||||
| 
 | ||||
|     // PDF viewers completely ignore any border styles.
 | ||||
|     this.data.borderStyle.setWidth(0); | ||||
|   } | ||||
| 
 | ||||
|   Util.inherit(StrikeOutAnnotation, Annotation, {}); | ||||
| 
 | ||||
|   return StrikeOutAnnotation; | ||||
| })(); | ||||
| 
 | ||||
| exports.Annotation = Annotation; | ||||
| exports.AnnotationBorderStyle = AnnotationBorderStyle; | ||||
| exports.AnnotationFactory = AnnotationFactory; | ||||
|  | ||||
| @ -75,6 +75,9 @@ AnnotationElementFactory.prototype = | ||||
|       case AnnotationType.UNDERLINE: | ||||
|         return new UnderlineAnnotationElement(parameters); | ||||
| 
 | ||||
|       case AnnotationType.STRIKEOUT: | ||||
|         return new StrikeOutAnnotationElement(parameters); | ||||
| 
 | ||||
|       default: | ||||
|         throw new Error('Unimplemented annotation type "' + subtype + '"'); | ||||
|     } | ||||
| @ -630,6 +633,33 @@ var UnderlineAnnotationElement = ( | ||||
|   return UnderlineAnnotationElement; | ||||
| })(); | ||||
| 
 | ||||
| /** | ||||
|  * @class | ||||
|  * @alias StrikeOutAnnotationElement | ||||
|  */ | ||||
| var StrikeOutAnnotationElement = ( | ||||
|     function StrikeOutAnnotationElementClosure() { | ||||
|   function StrikeOutAnnotationElement(parameters) { | ||||
|     AnnotationElement.call(this, parameters); | ||||
|   } | ||||
| 
 | ||||
|   Util.inherit(StrikeOutAnnotationElement, AnnotationElement, { | ||||
|     /** | ||||
|      * Render the strikeout annotation's HTML element in the empty container. | ||||
|      * | ||||
|      * @public | ||||
|      * @memberof StrikeOutAnnotationElement | ||||
|      * @returns {HTMLSectionElement} | ||||
|      */ | ||||
|     render: function StrikeOutAnnotationElement_render() { | ||||
|       this.container.className = 'strikeoutAnnotation'; | ||||
|       return this.container; | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   return StrikeOutAnnotationElement; | ||||
| })(); | ||||
| 
 | ||||
| /** | ||||
|  * @typedef {Object} AnnotationLayerParameters | ||||
|  * @property {PageViewport} viewport | ||||
|  | ||||
							
								
								
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -202,3 +202,4 @@ | ||||
| !annotation-link-text-popup.pdf | ||||
| !annotation-text-without-popup.pdf | ||||
| !annotation-underline.pdf | ||||
| !annotation-strikeout.pdf | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								test/pdfs/annotation-strikeout.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/pdfs/annotation-strikeout.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -2645,6 +2645,13 @@ | ||||
|        "type": "eq", | ||||
|        "annotations": true | ||||
|     }, | ||||
|     {  "id": "annotation-strikeout", | ||||
|        "file": "pdfs/annotation-strikeout.pdf", | ||||
|        "md5": "6624e6b5bedd2f2855b6ab12bbf93c57", | ||||
|        "rounds": 1, | ||||
|        "type": "eq", | ||||
|        "annotations": true | ||||
|     }, | ||||
|     {  "id": "issue6108", | ||||
|        "file": "pdfs/issue6108.pdf", | ||||
|        "md5": "8961cb55149495989a80bf0487e0f076", | ||||
|  | ||||
| @ -72,3 +72,7 @@ | ||||
| .annotationLayer .underlineAnnotation { | ||||
|   cursor: pointer; | ||||
| } | ||||
| 
 | ||||
| .annotationLayer .strikeoutAnnotation { | ||||
|   cursor: pointer; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user