equal
deleted
inserted
replaced
1 IriSP.Widgets.Sparkline = function(player, config) { |
1 IriSP.Widgets.Sparkline = function(player, config) { |
2 IriSP.Widgets.Widget.call(this, player, config); |
2 IriSP.Widgets.Widget.call(this, player, config); |
3 //this.bindPopcorn("timeupdate", "onTimeupdate"); |
|
4 }; |
3 }; |
5 |
4 |
6 IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget(); |
5 IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget(); |
7 |
6 |
8 IriSP.Widgets.Sparkline.prototype.defaults = { |
7 IriSP.Widgets.Sparkline.prototype.defaults = { |
66 |
65 |
67 this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2}); |
66 this.ligneProgress = this.paper.path("M0 0L0 "+this.height).attr({"stroke":"#ff00ff", "line-width" : 2}); |
68 |
67 |
69 this.$.click(function(_e) { |
68 this.$.click(function(_e) { |
70 var _x = _e.pageX - _this.$.offset().left; |
69 var _x = _e.pageX - _this.$.offset().left; |
71 _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width); |
70 _this.media.setCurrentTime(_this.media.duration * _x / _this.width); |
72 }); |
71 }); |
73 |
72 |
74 this.bindPopcorn("timeupdate","onTimeupdate"); |
73 this.onMediaEvent("timeupdate","onTimeupdate"); |
75 } |
74 } |
76 |
75 |
77 IriSP.Widgets.Sparkline.prototype.onTimeupdate = function() { |
76 IriSP.Widgets.Sparkline.prototype.onTimeupdate = function(_time) { |
78 var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds()); |
77 var _x = Math.floor( this.width * _time / this.media.duration); |
79 this.rectangleProgress.attr({ |
78 this.rectangleProgress.attr({ |
80 "width" : _x |
79 "width" : _x |
81 }); |
80 }); |
82 this.ligneProgress.attr({ |
81 this.ligneProgress.attr({ |
83 "path" : "M" + _x + " 0L" + _x + " " + this.height |
82 "path" : "M" + _x + " 0L" + _x + " " + this.height |