--- a/src/widgets/Segments.js Fri Oct 02 11:27:17 2015 +0200
+++ b/src/widgets/Segments.js Mon Dec 28 15:50:04 2015 +0100
@@ -18,6 +18,7 @@
faded_selected_color: "#baf9b5",
no_tooltip: false,
use_timerange: false,
+ scale_to_parent: true
};
IriSP.Widgets.Segments.prototype.template =
@@ -31,15 +32,15 @@
IriSP.Widgets.Segments.prototype.do_draw = function (isRedraw) {
- if (this.width != this.$.parent().width()) {
+ if (this.width != this.$.parent().width() && this.scale_to_parent) {
// Reset width
this.width = this.$.parent().width();
this.$.css({ width : this.width + "px" });
}
- var _list = this.getWidgetAnnotations().filter(function(_ann) {
- return _ann.getDuration() > 0;
- }),
- _this = this,
+ var _this = this,
+ _list = this.getWidgetAnnotations().filter(function(_ann) {
+ return _ann.getDuration() > 0 && _ann.getMedia().id == _this.media.id;
+ }),
_scale = this.width / this.source.getDuration(),
list_$ = this.$.find('.Ldt-Segments-List'),
lines = [],
@@ -185,6 +186,14 @@
});
});
+ this.onMediaEvent("resettimerange", function(){
+
+ _this.$segments.each(function(){
+ var _segment = IriSP.jQuery(this);
+ _segment.removeClass("selected");
+ })
+ });
+
this.$.css({
width : this.width + "px",
height : (((1 - this.overlap) * lines.length + this.overlap) * this.line_height) + "px",