Working with Annotations

Receiving annotation data

Whenever an annotation is clicked within the 3D scene, the selectannotation event will be broadcast from the iframe to the page with the following data:

event: 'selectannotation'
data: {
  // If its a content annotation
  id: <uuid>,
  title: <string?>,
  text: <string?>,
  file_id: <string?>,

  // If its a link annotation
  url: <string?>,

  // If its loading a different scene
  scene_id: <uuid?>
}

Example of how to listen for this event:

comms.on('selectannotation', function(data){
  console.log(data.title, data.text);
}

Closing an annotation

When an annotation is selected, it will pulsate in the 3D view to show that it is the selected one. When you want to close the annotation, send the following message to return the annotation back to its static state.

// Clears a selected annotation
comms.send('clearAnnotation');