Annotations
getAnnotations
getAnnotations(callback: Function)
Gets the current list of annotations in the viewer.
api.getAnnotations(function(annotations){
console.log(annotations);
});
Gets the current list of annotations in the viewer with translation record.
api.getAnnotations(function(annotations) {
console.log(annotations);
}, { transform: { translations: 'all' } });
getAnnotation
getAnnotation(id: string, callback: Function)
Gets the annotation information for the given id. Get the id
from the getAnnotations list.
api.getAnnotation('5fd779fe33de8920e73529f7', function(annotation){
console.log(annotation);
});
Gets the annotation information for the given id with translation record. Get the id
from the getAnnotations list.
api.getAnnotation('5fd779fe33de8920e73529f7', function(annotation){
console.log(annotation);
}, { transform: { translations: 'all' } });
selectAnnotation
selectAnnotation(id: string, callback: Function)
Selects the annotation for the given id. Get the id
from the getAnnotations list.
api.selectAnnotation('5fd779fe33de8920e73529f7', function(){
console.log('Annotation selected');
});
unselectAnnotation
unselectAnnotation(callback: Function)
Unselects the current annotation.
api.unselectAnnotation(function(){
console.log('Current Annotation unselected');
});
createAnnotation
createAnnotation(screenCoordinates: [x: number, y: number], options: object, callback: Function)
Creates a new annotation. Find the nearest intersection point (screenCoordinates
) with the object and set the result point as annotation target.
position
- the position of the camera (an array of 3D coordinates, [x, y, z]).
target
- the target of the camera (an array of 3D coordinates, [x, y, z]).
title
- the title of the annotation (string).
description
- the description of the annotation (string, Markdown supported).
api.createAnnotation([100, 100], {title: 'New title', description: 'New description', position: [2, 5, 8]}, function(annotation){
console.log(annotation);
});
createAnnotationWorldSpace
createAnnotationWorldSpace(coordinates: [x: number, y: number, z: number], options: object, callback: Function)
Creates a new annotation. Use the coordinates
as annotation target.
position
- the position of the camera (an array of 3D coordinates, [x, y, z]).
target
- the target of the camera (an array of 3D coordinates, [x, y, z]).
title
- the title of the annotation (string).
description
- the description of the annotation (string, Markdown supported).
api.createAnnotationWorldSpace([2, 2, 2], {title: 'New title', description: 'New description', position: [2, 5, 8]}, function(annotation){
console.log(annotation);
});
updateAnnotation
updateAnnotation(id: string, options: object, callback: Function)
Updates the annotation information for the given id. Get the id
from the getAnnotations list.
position
- the position of the camera (an array of 3D coordinates, [x, y, z]).
target
- the target of the camera (an array of 3D coordinates, [x, y, z]).
title
- the title of the annotation (string).
description
- the description of the annotation (string, Markdown supported).
api.updateAnnotation('5fd779fe33de8920e73529f7', {title: 'New title', description: 'New description', position: [2, 5, 8]}, function(annotation){
console.log(annotation); // Updated annotation object
});
removeAnnotation
removeAnnotation(id: string, callback: Function)
Removes the annotation for the given id. Get the id
from the getAnnotations list.
api.removeAnnotation('5fd779fe33de8920e73529f7', function(){
console.log('Annotation removed');
});
removeAnnotations
removeAnnotations(callback: Function)
Removes all annotations from the scene.
api.removeAnnotations(function(){
console.log('Annotations removed');
});