Annotations
rooomProducts Viewer API annotation controls. Create, manage, and interact with 3D product annotations, hotspots, and information overlays.
getAnnotations
getAnnotations(callback: Function, [options: object])
Gets the current list of annotations in the viewer.
api.getAnnotations(function(annotations){
console.log(annotations);
});Gets the current list of annotations with translation records.
api.getAnnotations(function(annotations) {
console.log(annotations);
}, { transform: { translations: 'all' } });getCurrentAnnotation
getCurrentAnnotation(callback: Function)
Gets the currently selected annotation. Returns the annotation object or undefined if none is selected.
api.getCurrentAnnotation(function(annotation){
console.log(annotation);
});getAnnotation
getAnnotation(id: string, callback: Function, [options: object])
Gets the annotation information for the given id. Get the id from the getAnnotations list.
api.getAnnotation('ANNOTATION_ID', function(annotation){
console.log(annotation);
});Gets the annotation information for the given id with translation records.
api.getAnnotation('ANNOTATION_ID', 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('ANNOTATION_ID', 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])
Create a new annotation. Finds the nearest intersection point (screenCoordinates) with the object and sets the result point as the 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])
Create a new annotation. Uses the coordinates as the 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('ANNOTATION_ID', {title: 'New title', description: 'New description', position: [2, 5, 8]}, function(annotation){
console.log(annotation);
});removeAnnotation
removeAnnotation(id: string, [callback: Function])
Removes the annotation for the given id. Get the id from the getAnnotations list.
api.removeAnnotation('ANNOTATION_ID', function(){
console.log('Annotation removed');
});removeAnnotations
removeAnnotations([callback: Function])
Removes all annotations from the scene.
api.removeAnnotations(function(){
console.log('Annotations removed');
});