Merge pull request #10723 from timvandermeij/caret-annotation
Implement caret annotations
This commit is contained in:
		
						commit
						74561f58b5
					
				@ -107,6 +107,9 @@ class AnnotationFactory {
 | 
			
		||||
      case 'Polygon':
 | 
			
		||||
        return new PolygonAnnotation(parameters);
 | 
			
		||||
 | 
			
		||||
      case 'Caret':
 | 
			
		||||
        return new CaretAnnotation(parameters);
 | 
			
		||||
 | 
			
		||||
      case 'Ink':
 | 
			
		||||
        return new InkAnnotation(parameters);
 | 
			
		||||
 | 
			
		||||
@ -1026,6 +1029,15 @@ class PolygonAnnotation extends PolylineAnnotation {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class CaretAnnotation extends Annotation {
 | 
			
		||||
  constructor(parameters) {
 | 
			
		||||
    super(parameters);
 | 
			
		||||
 | 
			
		||||
    this.data.annotationType = AnnotationType.CARET;
 | 
			
		||||
    this._preparePopup(parameters.dict);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class InkAnnotation extends Annotation {
 | 
			
		||||
  constructor(parameters) {
 | 
			
		||||
    super(parameters);
 | 
			
		||||
 | 
			
		||||
@ -83,6 +83,9 @@ class AnnotationElementFactory {
 | 
			
		||||
      case AnnotationType.POLYLINE:
 | 
			
		||||
        return new PolylineAnnotationElement(parameters);
 | 
			
		||||
 | 
			
		||||
      case AnnotationType.CARET:
 | 
			
		||||
        return new CaretAnnotationElement(parameters);
 | 
			
		||||
 | 
			
		||||
      case AnnotationType.INK:
 | 
			
		||||
        return new InkAnnotationElement(parameters);
 | 
			
		||||
 | 
			
		||||
@ -1017,6 +1020,30 @@ class PolygonAnnotationElement extends PolylineAnnotationElement {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class CaretAnnotationElement extends AnnotationElement {
 | 
			
		||||
  constructor(parameters) {
 | 
			
		||||
    const isRenderable = !!(parameters.data.hasPopup ||
 | 
			
		||||
                            parameters.data.title || parameters.data.contents);
 | 
			
		||||
    super(parameters, isRenderable, /* ignoreBorder = */ true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Render the caret annotation's HTML element in the empty container.
 | 
			
		||||
   *
 | 
			
		||||
   * @public
 | 
			
		||||
   * @memberof CaretAnnotationElement
 | 
			
		||||
   * @returns {HTMLSectionElement}
 | 
			
		||||
   */
 | 
			
		||||
  render() {
 | 
			
		||||
    this.container.className = 'caretAnnotation';
 | 
			
		||||
 | 
			
		||||
    if (!this.data.hasPopup) {
 | 
			
		||||
      this._createPopup(this.container, null, this.data);
 | 
			
		||||
    }
 | 
			
		||||
    return this.container;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class InkAnnotationElement extends AnnotationElement {
 | 
			
		||||
  constructor(parameters) {
 | 
			
		||||
    let isRenderable = !!(parameters.data.hasPopup ||
 | 
			
		||||
 | 
			
		||||
@ -188,6 +188,7 @@
 | 
			
		||||
.annotationLayer .circleAnnotation svg ellipse,
 | 
			
		||||
.annotationLayer .polylineAnnotation svg polyline,
 | 
			
		||||
.annotationLayer .polygonAnnotation svg polygon,
 | 
			
		||||
.annotationLayer .caretAnnotation,
 | 
			
		||||
.annotationLayer .inkAnnotation svg polyline,
 | 
			
		||||
.annotationLayer .stampAnnotation,
 | 
			
		||||
.annotationLayer .fileAttachmentAnnotation {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user