Commit 95c07383 by lduarte1991

Annotation Tools: Removed background-color from image annotations

- Also fixed edit bug when annotation is not created first
- Also fixed indentation issues
parent 7cc85b43
...@@ -167,7 +167,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -167,7 +167,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
var rectPosition = an.rangePosition; var rectPosition = an.rangePosition;
//Span //Span
span.className = "annotator-hl"; span.className = "annotator-hl";
span.style.border = '1px solid rgba(0,0,0,0.5)'; span.style.border = '2px solid rgba(0,0,0,0.5)';
span.style.background = 'rgba(0,0,0,0)';
var onAnnotationMouseMove = this.__bind(this._onAnnotationMouseMove,this); var onAnnotationMouseMove = this.__bind(this._onAnnotationMouseMove,this);
var onAnnotationClick = this.__bind(this._onAnnotationClick,this); var onAnnotationClick = this.__bind(this._onAnnotationClick,this);
$.addEvent(span, "mousemove", onAnnotationMouseMove, true); $.addEvent(span, "mousemove", onAnnotationMouseMove, true);
...@@ -219,8 +220,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -219,8 +220,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
var position = mouse.minus( elementPosition ); var position = mouse.minus( elementPosition );
viewer.innerTracker.setTracking(false); viewer.innerTracker.setTracking(false);
this.rect = document.createElement('div'); this.rect = document.createElement('div');
this.rect.style.background = 'rgba(0,0,0,0.25)'; this.rect.style.background = 'rgba(0,0,0,0)';
this.rect.style.border = '1px solid rgba(0,0,0,0.5)'; this.rect.style.border = '2px solid rgba(0,0,0,0.5)';
this.rect.style.position = 'absolute'; this.rect.style.position = 'absolute';
this.rect.className = 'DrawingRect'; this.rect.className = 'DrawingRect';
//set the initial position //set the initial position
...@@ -306,7 +307,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -306,7 +307,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
var maxx = l + w; var maxx = l + w;
var maxy = t + h; var maxy = t + h;
this.style.background = (y <= maxy && y >= t) && (x <= maxx && x >= l)? this.style.background = (y <= maxy && y >= t) && (x <= maxx && x >= l)?
'rgba(12, 150, 0, 0.3)':'rgba(255, 255, 10, 0.3)'; 'rgba(255, 255, 10, 0.05)':'rgba(0, 0, 0, 0)';
return (y <= maxy && y >= t) && (x <= maxx && x >= l)? jQuery(this).data("annotation") : null; return (y <= maxy && y >= t) && (x <= maxx && x >= l)? jQuery(this).data("annotation") : null;
}); });
//show the annotation in the viewer //show the annotation in the viewer
...@@ -586,8 +587,9 @@ Annotator.Plugin.OpenSeaDragon = (function(_super) { ...@@ -586,8 +587,9 @@ Annotator.Plugin.OpenSeaDragon = (function(_super) {
if (this.EditOpenSeaDragonAn()){ if (this.EditOpenSeaDragonAn()){
var annotator = this.annotator; var annotator = this.annotator;
var osda = annotator.osda; var osda = annotator.osda;
var position = osda.rectPosition; var position = osda.rectPosition || {};
var isNew = typeof annotation.media=='undefined'; var isNew = typeof annotation.media=='undefined';
if(isNew){
if (typeof annotation.media == 'undefined') annotation.media = "image"; // - media if (typeof annotation.media == 'undefined') annotation.media = "image"; // - media
annotation.target = annotation.target || {}; // - target annotation.target = annotation.target || {}; // - target
annotation.target.container = osda.viewer.id || ""; // - target.container annotation.target.container = osda.viewer.id || ""; // - target.container
...@@ -609,6 +611,7 @@ Annotator.Plugin.OpenSeaDragon = (function(_super) { ...@@ -609,6 +611,7 @@ Annotator.Plugin.OpenSeaDragon = (function(_super) {
annotation.updated = new Date().toISOString(); // - updated annotation.updated = new Date().toISOString(); // - updated
if (typeof annotation.created == 'undefined') if (typeof annotation.created == 'undefined')
annotation.created = annotation.updated; // - created annotation.created = annotation.updated; // - created
}
}else{ }else{
if (typeof annotation.media == 'undefined') if (typeof annotation.media == 'undefined')
annotation.media = "text"; // - media annotation.media = "text"; // - media
...@@ -691,7 +694,7 @@ Annotator.Plugin.OpenSeaDragon = (function(_super) { ...@@ -691,7 +694,7 @@ Annotator.Plugin.OpenSeaDragon = (function(_super) {
//-- Viewer //-- Viewer
function hideViewer(){ function hideViewer(){
jQuery(annotator.osda.viewer.canvas.parentNode).find('.annotator-hl').map(function() { jQuery(annotator.osda.viewer.canvas.parentNode).find('.annotator-hl').map(function() {
return this.style.background = 'rgba(255, 255, 10, 0.3)'; return this.style.background = 'rgba(0, 0, 0, 0)';
}); });
annotator.viewer.unsubscribe("hide", hideViewer); annotator.viewer.unsubscribe("hide", hideViewer);
}; };
...@@ -791,8 +794,8 @@ OpenSeadragonAnnotation = function (element, options) { ...@@ -791,8 +794,8 @@ OpenSeadragonAnnotation = function (element, options) {
if (typeof Annotator.Plugin["Flagging"] === 'function') if (typeof Annotator.Plugin["Flagging"] === 'function')
this.annotator.addPlugin("Flagging"); this.annotator.addPlugin("Flagging");
if (typeof Annotator.Plugin["HighlightTags"] === 'function') /*if (typeof Annotator.Plugin["HighlightTags"] === 'function')
this.annotator.addPlugin("HighlightTags", options.optionsAnnotator.highlightTags); this.annotator.addPlugin("HighlightTags", options.optionsAnnotator.highlightTags);*/
//- OpenSeaDragon //- OpenSeaDragon
this.viewer = OpenSeadragon(options.optionsOpenSeadragon); this.viewer = OpenSeadragon(options.optionsOpenSeadragon);
......
...@@ -826,6 +826,7 @@ CatchAnnotation.prototype = { ...@@ -826,6 +826,7 @@ CatchAnnotation.prototype = {
} }
for(var item in allannotations){ for(var item in allannotations){
var an = allannotations[item]; var an = allannotations[item];
an.highlights[0].style.background = "rgba(0,0,0,0)";
if (typeof an.id!='undefined' && an.id == osdaId){//this is the annotation 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); var bounds = new OpenSeadragon.Rect(an.bounds.x, an.bounds.y, an.bounds.width, an.bounds.height);
osda.viewer.viewport.fitBounds(bounds, false); osda.viewer.viewport.fitBounds(bounds, false);
...@@ -833,6 +834,7 @@ CatchAnnotation.prototype = { ...@@ -833,6 +834,7 @@ CatchAnnotation.prototype = {
console.log(an.target.container); console.log(an.target.container);
$('html,body').animate({scrollTop: $("#"+an.target.container).offset().top}, $('html,body').animate({scrollTop: $("#"+an.target.container).offset().top},
'slow'); 'slow');
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