This repository was archived by the owner on Apr 2, 2023. It is now read-only.
-
Couldn't load subscription status.
- Fork 142
JavaScript API
Rainer Simon edited this page Oct 16, 2012
·
51 revisions
Yuma provides a JavaScript API. You can use it to programmatically add/remove/change annotations, hook into Yuma's lifecycle events, etc. All functionality is exposed via a global yuma object.
yuma.getAnnotations(opt_image_src);
Returns the annotations currently on the page. The return type is an array of annotations. Use the optional opt_image_src parameter to get only the annotations for the image with the specified URL.
yuma.addAnnotation({
/** The URL of the image where the annotation should go **/
src : 'http://www.example.com/myimage.jpg',
/** The annotation text **/
text : 'My annotation',
/** The annotation shape **/
shape : {
/** The shape type: 'Rectangle', 'Point' or 'Polygon' **/
type : 'Rectangle',
/** The shape geometry **/
geometry : { x : 10, y: 10, width : 40, height: 60 }
}
});
Creates a new annotation and adds it to the page.
yuma.removeAnnotation(annotation);
Removes an annotation from the page.
TODO