Skip to content

Commit 4e5cf8d

Browse files
committed
verification view: show type of annotation
1 parent 085310f commit 4e5cf8d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

imagetagger/imagetagger/annotations/static/annotations/js/verification.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function calculateImageScale() {
2424
let gHeaders;
2525
let gHideFeedbackTimeout;
2626
let gAnnotationList;
27+
let gAnnotationTypes;
2728
let gImageId;
2829
let gImageSet;
2930
let gImageSetId;
@@ -81,7 +82,9 @@ function calculateImageScale() {
8182
headers: gHeaders,
8283
dataType: 'json',
8384
success: function (data) {
84-
displayAnnotationTypeOptions(data.annotation_types);
85+
gAnnotationTypes = data.annotation_types;
86+
displayAnnotationTypeOptions();
87+
loadFilteredAnnotationList(gImageSetId);
8588
},
8689
error: function () {
8790
displayFeedback($('#feedback_connection_error'))
@@ -241,7 +244,10 @@ function calculateImageScale() {
241244
annotation_text_array.push("'x" + i + "': " + annotation.vector["x" + i] +
242245
", 'y" + i + "': " + annotation.vector["y" + i]);
243246
}
244-
link.text(shorten("{" + annotation_text_array.join(', ') + "}"));
247+
let annotation_type = gAnnotationTypes.filter(function (e) {
248+
return e.id === annotation.annotation_type;
249+
})[0].name;
250+
link.text(shorten(annotation_type + " {" + annotation_text_array.join(', ') + "}"));
245251
}
246252

247253
link.data('annotationid', annotation.id);
@@ -273,10 +279,10 @@ function calculateImageScale() {
273279
}
274280
}
275281

276-
function displayAnnotationTypeOptions(annotationTypeList) {
282+
function displayAnnotationTypeOptions() {
277283
// TODO: empty the options?
278284
let annotationTypeSelect = $('#annotation_type_select');
279-
$.each(annotationTypeList, function (key, annotationType) {
285+
$.each(gAnnotationTypes, function (key, annotationType) {
280286
annotationTypeSelect.append($('<option/>', {
281287
name: annotationType.name,
282288
value: annotationType.id,
@@ -573,7 +579,6 @@ function calculateImageScale() {
573579
$('#blurred_label').hide();
574580
$('#concealed_label').hide();
575581
loadAnnotationTypeList(gImageSetId);
576-
loadFilteredAnnotationList(gImageSetId);
577582

578583
$('#filter_update_btn').on('click', handleFilterSwitchChange);
579584

0 commit comments

Comments
 (0)