blob: 5965dbde63f74cbe50d580335c779730aa374fdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
ClipPlay.Collections.Samples = Backbone.Collection.extend({
model: ClipPlay.Models.Sample,
// -----------------------------------------------------------------------
// What follows is WRONG. Change so that the following functions don't use
// any DOM elements
// -----------------------------------------------------------------------
// percentage_progress
//
// Get a percentage value from a clip-line that represents its
// position within the progress bar.
//
percentage_progress: function($el) {
var container = $el.parents('.progress-bar');
var position_in_pixels = $el.css('left');
var percentage = (position_in_pixels / container.width()) * 100;
return percentage;
},
// seek_point
//
// Example:
// sample_editor.seek_point({
// $el: $('.clip-line'),
// video_length: 586
// });
//
seek_point: function(options) {
var options = options || {};
var progress = this.percentage_progress(options.$el);
return (progress * options.video_length) / 100;
}
});
|