diff -r c9dd78a43b07 -r 5b7ae96768be cms/app-client/app/components/transcript-component.js --- a/cms/app-client/app/components/transcript-component.js Wed Jul 20 21:08:31 2016 +0200 +++ b/cms/app-client/app/components/transcript-component.js Thu Jul 21 23:36:50 2016 +0200 @@ -2,8 +2,30 @@ export default Ember.Component.extend({ - player: Ember.inject.service(), + classNames: ['transcript-component'], + + player: Ember.inject.service(), + + autoscroll: true, + autoscrollElement : Ember.$('.corpus-app-container'), + + itemObserver: Ember.observer('player.item', function () { + this.set('autoscroll', true); + }), - language: 'fr' + init: function() { + var self = this; + this.get('autoscrollElement').bind('scroll', function() { + self.set('autoscroll', false); + }); + + this._super(...arguments); + }, + + didUpdate: function() { + if(this.get('autoscroll')) { + this.get('autoscrollElement').scrollTop((Ember.$('.sentence.active').offset().top + this.get('autoscrollElement').scrollTop()) - this.get('autoscrollElement').offset().top) + } + } });