diff options
Diffstat (limited to 'assets/js/views/clip-line.js')
| -rw-r--r-- | assets/js/views/clip-line.js | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/assets/js/views/clip-line.js b/assets/js/views/clip-line.js index 208c927..2760d5b 100644 --- a/assets/js/views/clip-line.js +++ b/assets/js/views/clip-line.js @@ -6,6 +6,10 @@ ClipPlay.Views.ClipLine = Marionette.View.extend({ this.type = options.type; + this.listenTo(this.model, 'change:duration', this.initialize_time_values); + var start_or_stop = this.type; + this.listenTo(this.model, 'change:' + start_or_stop, this.render_time); + this.initialize_drag_handles(); }, @@ -19,12 +23,33 @@ ClipPlay.Views.ClipLine = Marionette.View.extend({ }); var that = this; - this.$el.on('dragstop', function(e, ui) { - that.on_clip_drag_stop(e, ui); + + this.$el.on('drag', function(e, ui) { + that.on_clip_drag(e, ui); }); }, + initialize_time_values: function() { + this.set_seek_point(); + this.render_time(); + }, + + + render_time: function() { + var time; + if (this.type === 'start') { + time = this.model.start_in_minutes_and_seconds(); + } + else if (this.type === 'stop') { + time = this.model.stop_in_minutes_and_seconds(); + } + + var time_string = time.minutes + ':' + time.seconds; + this.$('.js-time').text(time_string); + }, + + // percentage_progress // // Get a percentage value from a clip-line that represents its @@ -52,7 +77,12 @@ ClipPlay.Views.ClipLine = Marionette.View.extend({ }, - on_clip_drag_stop: function(e, ui) { + set_seek_point: function() { this.model.set(this.type, this.seek_point()); + }, + + + on_clip_drag: function(e, ui) { + this.set_seek_point(); } });
\ No newline at end of file |
