equal
deleted
inserted
replaced
7 }; |
7 }; |
8 |
8 |
9 IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget(); |
9 IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget(); |
10 |
10 |
11 IriSP.Widgets.Slice.prototype.defaults = { |
11 IriSP.Widgets.Slice.prototype.defaults = { |
12 start_visible : false |
12 start_visible : false, |
|
13 pause_on_change : true, |
|
14 live_update : true |
|
15 /* Shall the bounds change each time |
|
16 the Annotation Widget sends an update (true) |
|
17 or only when "show" is triggered (false) ? |
|
18 - true is to be recommended when the widget is permanently displayed. |
|
19 */ |
13 }; |
20 }; |
14 |
21 |
15 IriSP.Widgets.Slice.prototype.draw = function() { |
22 IriSP.Widgets.Slice.prototype.draw = function() { |
16 |
23 |
17 this.$slider = IriSP.jQuery('<div>') |
24 this.$slider = IriSP.jQuery('<div>') |
33 _this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{ |
40 _this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{ |
34 widget:_this.type, |
41 widget:_this.type, |
35 time:Math.floor((ui.values[0]+ui.values[1])/2) |
42 time:Math.floor((ui.values[0]+ui.values[1])/2) |
36 }); |
43 }); |
37 _this.player.popcorn.trigger("IriSP.Slice.boundsChanged",[ui.values[0], ui.values[1]]); |
44 _this.player.popcorn.trigger("IriSP.Slice.boundsChanged",[ui.values[0], ui.values[1]]); |
|
45 }, |
|
46 start: function() { |
|
47 if (_this.pause_on_change && !_this.player.popcorn.media.paused) { |
|
48 _this.player.popcorn.pause(); |
|
49 } |
38 } |
50 } |
39 }); |
51 }); |
40 this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle"); |
52 this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle"); |
41 this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle"); |
53 this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle"); |
42 if (this.start_visible) { |
54 if (this.start_visible) { |
45 this.hide(); |
57 this.hide(); |
46 } |
58 } |
47 this.bindPopcorn("IriSP.Slice.show","show"); |
59 this.bindPopcorn("IriSP.Slice.show","show"); |
48 this.bindPopcorn("IriSP.Slice.hide","hide"); |
60 this.bindPopcorn("IriSP.Slice.hide","hide"); |
49 this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds"); |
61 this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds"); |
|
62 this.trigger("IriSP.Annotation.getBounds"); |
50 }; |
63 }; |
51 |
64 |
52 IriSP.Widgets.Slice.prototype.show = function() { |
65 IriSP.Widgets.Slice.prototype.show = function() { |
53 this.$slider.show(); |
66 this.$slider.show(); |
54 this.player.popcorn.trigger("IriSP.Arrow.takeover",this.type); |
67 this.player.popcorn.trigger("IriSP.Arrow.takeover",this.type); |
61 } |
74 } |
62 |
75 |
63 IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { |
76 IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { |
64 this.min = _values[0]; |
77 this.min = _values[0]; |
65 this.max = _values[1]; |
78 this.max = _values[1]; |
|
79 if (this.live_update) { |
|
80 this.$slider.slider("values", [this.min, this.max]); |
|
81 } |
66 } |
82 } |