PS2AnnotationViewer
This is the main class used to display annotations (highlights). It need to be used with a PS2Viewer.
Constructor
Name |
Definition |
Description |
PS2AnnotationViewer |
PS2AnnotationViewer(PS2Viewer, options?: PS2AnnotationViewerOptions) |
Initialize a new instance of the PS2AnnotationViewer class. |
Methods
Name |
Return value |
Description |
addEventListener(eventName, callback) |
None |
Register the provided callback to the specified event. |
clear() |
None |
Remove all annotations from the viewer. |
dispose() |
None |
Deletes the viewer object and releases any associated resources. (TODO: implement this) |
getInternal() |
PS.Packet.Annotation.Viewer |
Return the internal PS.Packet.Annotation.Viewer object (use with caution!). |
load(annotations) |
None |
Load the provided annotations in the viewer (it's not clearing first, thus the default behavior is to append). |
removeEventListener(eventName, callback) |
None |
Remove the callback previously registered with addEventListener. |
Events
Name |
Arguments |
Description |
init |
PS2AnnotationViewer |
Occurs when the associated PS2Viewer is built (= the first time the PS2Viewer load a dataset) |
annotation-click |
Annotation, restingCamera |
Occurs when the user click on annotation. You can return false to prevent the default zoomToAnnotation behavior. |
annotation-edit |
Annotation, tx, ty |
Occurs when the user click on the edit button on an annotation (the editEnabled option of the constructor need to be true). |
annotation-delete |
Annotation |
Occurs when the user click on the delete button on an annotation (the editEnabled option of the constructor need to be true). |
edit-annotation-move |
Annotation, tx, ty |
Internal usage. |
Example
Minimal setup:
var _container = document.getElementById("viewer-container");
var _viewer = new Photosynth.PS2Viewer(_container, {
pathToWorker: "js/PS2PacketPlayer.worker.min.js"
});
_viewer.loadGuid("676195e2-64ca-43f5-80ba-a7cb7b10e3aa");
//TODO: add code snipet... (you can check the code in ps-player-sdk-highlight.html)