equal
deleted
inserted
replaced
9 |
9 |
10 IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget(); |
10 IriSP.Widgets.Slice.prototype = new IriSP.Widgets.Widget(); |
11 |
11 |
12 IriSP.Widgets.Slice.prototype.defaults = { |
12 IriSP.Widgets.Slice.prototype.defaults = { |
13 start_visible : false, |
13 start_visible : false, |
14 live_update : true |
14 live_update : true, |
15 /* Shall the bounds change each time |
15 /* Shall the bounds change each time |
16 the Annotation Widget sends an update (true) |
16 the Annotation Widget sends an update (true) |
17 or only when "show" is triggered (false) ? |
17 or only when "show" is triggered (false) ? |
18 - true is to be recommended when the widget is permanently displayed. |
18 - true is to be recommended when the widget is permanently displayed. |
19 */ |
19 */ |
|
20 override_bounds : true |
|
21 /* Can the Annotation Widget bounds be overriden ? */ |
20 }; |
22 }; |
21 |
23 |
22 IriSP.Widgets.Slice.prototype.draw = function() { |
24 IriSP.Widgets.Slice.prototype.draw = function() { |
23 |
25 |
24 this.$slider = IriSP.jQuery('<div>') |
26 this.$slider = IriSP.jQuery('<div>') |
50 _this.player.popcorn.pause(); |
52 _this.player.popcorn.pause(); |
51 } |
53 } |
52 _currentTime = _this.player.popcorn.currentTime(); |
54 _currentTime = _this.player.popcorn.currentTime(); |
53 }, |
55 }, |
54 slide: function(event, ui) { |
56 slide: function(event, ui) { |
|
57 if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) { |
|
58 return false; |
|
59 } |
55 _this.player.popcorn.currentTime(ui.value / 1000); |
60 _this.player.popcorn.currentTime(ui.value / 1000); |
56 }, |
61 }, |
57 stop: function() { |
62 stop: function() { |
58 _this.sliding = false; |
63 _this.sliding = false; |
59 _this.player.popcorn.currentTime(_currentTime); |
64 _this.player.popcorn.currentTime(_currentTime); |
67 this.hide(); |
72 this.hide(); |
68 } |
73 } |
69 this.bindPopcorn("IriSP.Slice.show","show"); |
74 this.bindPopcorn("IriSP.Slice.show","show"); |
70 this.bindPopcorn("IriSP.Slice.hide","hide"); |
75 this.bindPopcorn("IriSP.Slice.hide","hide"); |
71 this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds"); |
76 this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds"); |
72 this.trigger("IriSP.Annotation.getBounds"); |
77 this.player.popcorn.trigger("IriSP.Annotation.getBounds"); |
73 }; |
78 }; |
74 |
79 |
75 IriSP.Widgets.Slice.prototype.show = function() { |
80 IriSP.Widgets.Slice.prototype.show = function() { |
76 this.$slider.show(); |
81 this.$slider.show(); |
77 this.player.popcorn.trigger("IriSP.Arrow.takeover",this.type); |
82 this.player.popcorn.trigger("IriSP.Arrow.takeover",this.type); |
82 this.$slider.hide(); |
87 this.$slider.hide(); |
83 this.player.popcorn.trigger("IriSP.Arrow.release"); |
88 this.player.popcorn.trigger("IriSP.Arrow.release"); |
84 } |
89 } |
85 |
90 |
86 IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { |
91 IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { |
87 if (!this.sliding && !this.player.popcorn.media.paused && (this.min != _values[0] || this.max != _values[1])) { |
92 if (!this.player.popcorn.media.paused && (this.min != _values[0] || this.max != _values[1])) { |
88 this.min = _values[0]; |
93 this.min = _values[0]; |
89 this.max = _values[1]; |
94 this.max = _values[1]; |
90 if (this.live_update) { |
95 if (this.live_update && !this.sliding) { |
91 this.$slider.slider("values", [this.min, this.max]); |
96 this.$slider.slider("values", [this.min, this.max]); |
92 } |
97 } |
93 } |
98 } |
94 } |
99 } |