Commit cd9c6c5f by lduarte1991

Annotations Tools: Commented OSDA code and added clarification to catch changes

parent 95c07383
......@@ -636,14 +636,27 @@ CatchAnnotation.prototype = {
});
annotator.subscribe("annotationCreated", function (annotation){
var attempts = 0; // max 100
//wait to get an annotation id
//There is a delay between calls to the backend--especially reading after
//writing. This function listens to when a function is created and waits
//until the server provides it with an annotation id before doing anything
//with it.
var ischanged = function(){
if (attempts<100)
setTimeout(function(){
if (typeof annotation.id!='undefined'){
//once it gets the annotation id, the table refreshes to show
//the edits
self.refreshCatch();
if (typeof annotation.parent != 'undefined' && annotation.parent != '0'){
//if annotation made was actually a replay to an annotation
//i.e. the only difference is that annotations that are
//not replies have no "parent"
var replies = $("[annotationid="+annotation.parent+"]").find(".controlReplies .hideReplies");
//forces "Show replies" section to show and then refreshes
//via two clicks
replies.show();
replies.click();
replies.click();
......@@ -826,6 +839,8 @@ CatchAnnotation.prototype = {
}
for(var item in allannotations){
var an = allannotations[item];
//Makes sure that all images are set to transparent in case one was
//previously selected.
an.highlights[0].style.background = "rgba(0,0,0,0)";
if (typeof an.id!='undefined' && an.id == osdaId){//this is the annotation
var bounds = new OpenSeadragon.Rect(an.bounds.x, an.bounds.y, an.bounds.width, an.bounds.height);
......@@ -834,6 +849,8 @@ CatchAnnotation.prototype = {
console.log(an.target.container);
$('html,body').animate({scrollTop: $("#"+an.target.container).offset().top},
'slow');
//signifies a selected annotation once OSD has zoomed in on the
//appropriate area, it turns the background a bit yellow
an.highlights[0].style.background = "rgba(255,255,10,0.2)";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment