Annotation (comments/annotations)



Represents an annotation.

Annotation is an entity that combines an AnnotationView and an annotation target (a DOM element or a Rect) to which the annotation is bound.



  • focusableElements : Collection

    A collection of DOM elements which, when focused, make the annotation active.

    By default, this collection only contains the annotation view element. It can be extended with custom targets that will be tracked by the annotation focus tracking system.

  • innerView : View

    The annotation inner view.

    It is the view that is wrapped by the annotation view.

  • isActive : Boolean

    The state of the annotation.

  • observable

    isVisible : Boolean

    The visibility of the annotation. Annotations that are not visible, are filtered from Annotation UI collections.

  • target : Rect | Array.<Element> | null

    The annotation target to which the annotation view should be pinned.

    It can be an array of DOM elements or a rect instance or null.

  • targetRect : Rect | null

    The position and dimensions of the annotation target to which the annotation is bound.

  • type : String

    The type of the annotation.

  • view : AnnotationView

    The annotation view.


  • constructor( options = { options.view,, options.type, [options.isVisible] } )

    Creates an instance of the Annotation.


    options : Object
    options.view : AnnotationView

    The annotation view. : Rect | function | Element | Array.<Element>

    The annotation target.

    options.type : String | function

    The annotation type.

    [ options.isVisible ] : Boolean

    The initial visibility of the annotation.

  • destroy()

    Clears all event listeners and internal collections.

  • refreshVisibility()

    Refreshes the visibility of the annotation based on the visibility of the annotation target.

    It sets the isVisible property when the target is not attached to DOM or if the target or its descendant has set the display attribute to none.

    This method only updates an annotation if the annotation target is an HTML Element.

  • updateTargetRect()

    Updates the target rect in the annotation view instance.


  • change:isVisible( eventInfo, name, value, oldValue )

    Fired when the isVisible property changed value.


    eventInfo : EventInfo

    An object containing information about the fired event.

    name : String

    Name of the changed property (isVisible).

    value : Boolean

    New value of the isVisible property with given key or null, if operation should remove property.

    oldValue : Boolean

    Old value of the isVisible property with given key or null, if property was not set before.