Skip to content

Commit

Permalink
blur image in unified mode after labels/annotations added
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard B committed Mar 29, 2020
1 parent 7cff599 commit a2b20d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
10 changes: 5 additions & 5 deletions html/templates/modules/annotation_browse_select_mode.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@
});
}

function showBrowseAnnotationImageGrid(annotatedEntriesIds = null) {
function showBrowseAnnotationImageGrid(imageGridImageIdentifiers = null) {
//if the image grid gets shown again, the image in question was successfully annotated/blacklisted or marked
//as non-annotatable. We now grey the image out and change the mouse cursor to default again.

if(annotatedEntriesIds !== null) {
for(var i = 0; i < annotatedEntriesIds.length; i++) {
$("#"+annotatedEntriesIds[i]).addClass("grey-out");
$("#"+annotatedEntriesIds[i]).css('cursor', 'default');
if(imageGridImageIdentifiers !== null) {
for(var i = 0; i < imageGridImageIdentifiers.length; i++) {
$("#"+imageGridImageIdentifiers[i]).addClass("grey-out");
$("#"+imageGridImageIdentifiers[i]).css('cursor', 'default');
}
}

Expand Down
28 changes: 18 additions & 10 deletions js/imagemonkey/views/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ var AnnotationView = (function() {


AnnotationView.prototype.addAnnotationsUnifiedMode = function() {
var validationIds = [];
var imageGridImageIdentifiers = [];
var annotations = [];
for (var key in this.unifiedModeAnnotations) {
if (this.unifiedModeAnnotations.hasOwnProperty(key)) {
Expand All @@ -268,18 +268,26 @@ var AnnotationView = (function() {
annotation["sublabel"] = entry.sublabel;
annotations.push(annotation);

if ("validationUuid" in entry && entry.validationUuid !== null)
validationIds.push(entry.validationUuid);
if ("validationUuid" in entry && entry.validationUuid !== null && entry.validationUuid !== undefined) {
imageGridImageIdentifiers.push(entry.validationUuid);
}
}
}
}

if (imageGridImageIdentifiers.length === 0) {
if (this.annotationInfo.validationId !== undefined)
imageGridImageIdentifiers.push(this.annotationInfo.validationId);
else
imageGridImageIdentifiers.push(this.annotationInfo.imageId);
}

this.unifiedModeLabels = {};
this.unifiedModeAnnotations = {};
this.addAnnotations(annotations, validationIds);
this.addAnnotations(annotations, imageGridImageIdentifiers);
}

AnnotationView.prototype.addAnnotations = function(annotations, validationIds = null) {
AnnotationView.prototype.addAnnotations = function(annotations, imageGridImageIdentifiers = null) {
var headers = {}
if (this.browserFingerprint !== null)
headers["X-Browser-Fingerprint"] = this.browserFingerprint;
Expand All @@ -291,7 +299,7 @@ var AnnotationView = (function() {
this.annotator.reset();

if (annotations.length === 0) {
this.onAddAnnotationsDone();
this.onAddAnnotationsDone(imageGridImageIdentifiers);
return;
}

Expand All @@ -306,18 +314,18 @@ var AnnotationView = (function() {
xhr.setRequestHeader("Authorization", "Bearer " + getCookie("imagemonkey"))
},
success: function(data) {
inst.onAddAnnotationsDone(validationIds);
inst.onAddAnnotationsDone(imageGridImageIdentifiers);
}
});
}

AnnotationView.prototype.onAddAnnotationsDone = function(validationIds = null) {
AnnotationView.prototype.onAddAnnotationsDone = function(imageGridImageIdentifiers = null) {
if (this.annotationMode === "default")
this.loadUnannotatedImage();
else {
$("#loadingSpinner").hide();
changeNavHeader("browse");
showBrowseAnnotationImageGrid(validationIds);
showBrowseAnnotationImageGrid(imageGridImageIdentifiers);
$("#isPluralContainer").hide();
}

Expand Down Expand Up @@ -1685,4 +1693,4 @@ var AnnotationView = (function() {
}

return AnnotationView;
}());
}());
2 changes: 1 addition & 1 deletion js/imagemonkey/views/annotation.min.js

Large diffs are not rendered by default.

0 comments on commit a2b20d6

Please sign in to comment.