src/widgets/MultiSegments.js
changeset 1013 392ddcd212d7
parent 988 eefd336335f9
child 1021 7253d4d06f0d
equal deleted inserted replaced
1012:7e18d953a1f8 1013:392ddcd212d7
     7 IriSP.Widgets.MultiSegments.prototype.defaults = {
     7 IriSP.Widgets.MultiSegments.prototype.defaults = {
     8     annotation_show_arrow: true,
     8     annotation_show_arrow: true,
     9     annotation_start_minimized: true,
     9     annotation_start_minimized: true,
    10     annotation_show_annotation_type: true,
    10     annotation_show_annotation_type: true,
    11     show_all: false
    11     show_all: false
    12 }
    12 };
    13 
    13 
    14 IriSP.Widgets.MultiSegments.prototype.draw = function() {
    14 IriSP.Widgets.MultiSegments.prototype.draw = function() {
    15     var _this = this,
    15     var _this = this,
    16         lines = [],
    16         lines = [],
    17         currentLine = null,
    17         currentLine = null,
    22             segmentsopts[_k.replace(/^segments_/,"")] = _v;
    22             segmentsopts[_k.replace(/^segments_/,"")] = _v;
    23         }
    23         }
    24         if (/^annotation_/.test(_k)) {
    24         if (/^annotation_/.test(_k)) {
    25             annotationopts[_k.replace(/^annotation_/,"")] = _v;
    25             annotationopts[_k.replace(/^annotation_/,"")] = _v;
    26         }
    26         }
    27     })
    27     });
    28     this.source.getAnnotationTypes().forEach(function(_anntype) {
    28     this.source.getAnnotationTypes().forEach(function(_anntype) {
    29         var segments = _anntype.getAnnotations().filter(function(_ann) {
    29         var segments = _anntype.getAnnotations().filter(function(_ann) {
    30             return _ann.getDuration() > 0;
    30             return _ann.getDuration() > 0;
    31         });
    31         });
    32         if (segments.length) {
    32         if (segments.length) {
    52                     if (!visible) {
    52                     if (!visible) {
    53                         visible = true;
    53                         visible = true;
    54                         this.annotationWidget.slideDown();
    54                         this.annotationWidget.slideDown();
    55                     }
    55                     }
    56                 }
    56                 }
    57             }
    57             };
    58                 
    58                 
    59                 
    59                 
    60             line.segmentWidget
    60             line.segmentWidget
    61                 .addClass("Ldt-MultiSegments-Segment")
    61                 .addClass("Ldt-MultiSegments-Segment")
    62                 .appendTo(_this.$);
    62                 .appendTo(_this.$);
    94             );
    94             );
    95             
    95             
    96             lines.push(line);
    96             lines.push(line);
    97         }
    97         }
    98     });
    98     });
    99     var _annotationWidgets = _this.$.find(".Ldt-MultiSegments-Annotation")
    99     var _annotationWidgets = _this.$.find(".Ldt-MultiSegments-Annotation");
   100     
   100     
   101     function checkVisibilities(_time) {
   101     function checkVisibilities(_time) {
   102         if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
   102         if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
   103             currentLine = undefined;
   103             currentLine = undefined;
   104         }
   104         }
   117             }
   117             }
   118         });
   118         });
   119     }
   119     }
   120     
   120     
   121     this.onMediaEvent("timeupdate", checkVisibilities);
   121     this.onMediaEvent("timeupdate", checkVisibilities);
   122 }
   122 };