PS2AnnotationEditor

This is the main class used to create/edit annotations (highlights). It need to be used with a PS2Viewer and PS2AnnotationViewer.


Constructor

Name Definition Description
PS2AnnotationEditor PS2AnnotationEditor(PS2Viewer, PS2AnnotationViewer, containerElement:node) Initialize a new instance of the PS2AnnotationEditor class.

Methods

Name Return value Description
addEventListener(eventName, callback) None Register the provided callback to the specified event.
dispose() None Deletes the editor object and releases any associated resources. (TODO: implement this)
getInternal() PS.Packet.Annotation.Editor Return the internal PS.Packet.Annotation.Editor object (use with caution!).
removeEventListener(eventName, callback) None Remove the callback previously registered with addEventListener.

Events

Name Arguments Description
annotation-created Annotation, thumbInfo, callback Occurs when an annotation is created.
You need to fire the callback: callback(isSaved, dbid).
First argument is true when the annotation was successfully saved in the storage. And the second argument is the databased unique ID of the annotation in the storage.
annotation-edited Annotation, thumbInfo, callback Occurs when an annotation is edited. (parameter are identical as annotation-created event).
annotation-delete Annotation, callback Occurs when an annotation is about to be deleted.
You need to fire the callback: callback(needToBeDeleted).
First argument is a boolean indicating if the annotation needs to be deleted (result of confirm dialog box).
cancel None Occurs when the user cancel.
synth-connection-requested request, dbid Experimental.
visibility-change visible Internal usage. Inform whether the editor is visible or not.

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)