@@ -24,6 +24,7 @@ function calculateImageScale() {
24
24
let gHeaders ;
25
25
let gHideFeedbackTimeout ;
26
26
let gAnnotationList ;
27
+ let gAnnotationTypes ;
27
28
let gImageId ;
28
29
let gImageSet ;
29
30
let gImageSetId ;
@@ -81,7 +82,9 @@ function calculateImageScale() {
81
82
headers : gHeaders ,
82
83
dataType : 'json' ,
83
84
success : function ( data ) {
84
- displayAnnotationTypeOptions ( data . annotation_types ) ;
85
+ gAnnotationTypes = data . annotation_types ;
86
+ displayAnnotationTypeOptions ( ) ;
87
+ loadFilteredAnnotationList ( gImageSetId ) ;
85
88
} ,
86
89
error : function ( ) {
87
90
displayFeedback ( $ ( '#feedback_connection_error' ) )
@@ -241,7 +244,10 @@ function calculateImageScale() {
241
244
annotation_text_array . push ( "'x" + i + "': " + annotation . vector [ "x" + i ] +
242
245
", 'y" + i + "': " + annotation . vector [ "y" + i ] ) ;
243
246
}
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 ( ', ' ) + "}" ) ) ;
245
251
}
246
252
247
253
link . data ( 'annotationid' , annotation . id ) ;
@@ -273,10 +279,10 @@ function calculateImageScale() {
273
279
}
274
280
}
275
281
276
- function displayAnnotationTypeOptions ( annotationTypeList ) {
282
+ function displayAnnotationTypeOptions ( ) {
277
283
// TODO: empty the options?
278
284
let annotationTypeSelect = $ ( '#annotation_type_select' ) ;
279
- $ . each ( annotationTypeList , function ( key , annotationType ) {
285
+ $ . each ( gAnnotationTypes , function ( key , annotationType ) {
280
286
annotationTypeSelect . append ( $ ( '<option/>' , {
281
287
name : annotationType . name ,
282
288
value : annotationType . id ,
@@ -573,7 +579,6 @@ function calculateImageScale() {
573
579
$ ( '#blurred_label' ) . hide ( ) ;
574
580
$ ( '#concealed_label' ) . hide ( ) ;
575
581
loadAnnotationTypeList ( gImageSetId ) ;
576
- loadFilteredAnnotationList ( gImageSetId ) ;
577
582
578
583
$ ( '#filter_update_btn' ) . on ( 'click' , handleFilterSwitchChange ) ;
579
584
0 commit comments