Interface: AnnotationsPressEvent

PSPDFKit.AnnotationsPressEvent

This event is emitted whenever an annotation is either clicked or touched (on devices with touch capabilities) as well as when an already selected annotation receives a click or touch event.

Use this event to add custom behavior or prevent default ones from happening on press.

Please note that this event will not be fired for annotations which are not editable. If you still want to detect clicks for such annotations, for example, to show a focus ring when clicked, you can use custom renderers to made a clickable area above each annotation. This method is described fully in our Knowledge Base.

Example

Prevent click and touch events on selected annotations

instance.addEventListener("annotations.press", (event) => {
  if (event.selected) {
    event.preventDefault();
  }
});

Members




Members

annotation: AnnotationsUnion

The annotation that was pressed. Remember that annotations are Immutable.map.

Type:

nativeEvent: Event

The browser event which caused the press event to dispatch. This is either a MouseEvent, TouchEvent, or a PointerEvent.

Type:
  • Event

preventDefault: function

When invoked, the preventDefault method prevents the default press actions associated with the annotation to occur.

Type:
  • function

selected: boolean

Tells whether the pressed annotation is selected or not.

Type:
  • boolean