diff --git a/app/js/directives.js b/app/js/directives.js index b2994659..c7761ea7 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1968,6 +1968,7 @@ angular.module('myApp.directives', ['myApp.filters']) AppDocsManager.updateDocDownloaded($scope.audio.id); } + $scope.volume = audioVolume; $scope.mediaPlayer = {}; $scope.download = function () { @@ -2035,11 +2036,22 @@ angular.module('myApp.directives', ['myApp.filters']) var thumbWidth = Math.ceil(thumb.width()); var model = attrs.sliderModel; var sliderCallback = attrs.sliderOnchange; - var minValue = $scope.$eval(attrs.sliderMin) || 0.0; - var maxValue = $scope.$eval(attrs.sliderMax) || 1.0; + var minValue = 0.0; + var maxValue = 1.0; var lastUpdValue = false; var lastMinPageX = false; + if (attrs.sliderMin) { + $scope.$watch(attrs.sliderMin, function (newMinValue) { + minValue = newMinValue || 0.0; + }); + } + if (attrs.sliderMax) { + $scope.$watch(attrs.sliderMax, function (newMaxValue) { + maxValue = newMaxValue || 1.0; + }); + } + var onMouseMove = function (e) { var offsetX = e.pageX - lastMinPageX; offsetX = Math.min(width, Math.max(0 , offsetX)); @@ -2062,10 +2074,10 @@ angular.module('myApp.directives', ['myApp.filters']) }; $scope.$watch(model, function (newVal) { - if (newVal != lastUpdValue) { + if (newVal != lastUpdValue && newVal !== undefined) { var percent = Math.max(0, (newVal - minValue) / (maxValue - minValue)); if (width) { - var offsetX = width * percent; + var offsetX = Math.ceil(width * percent); offsetX = Math.min(width, Math.max(0 , offsetX)); thumb.css('left', Math.max(0, offsetX - thumbWidth)); fill.css('width', offsetX); @@ -2098,7 +2110,7 @@ angular.module('myApp.directives', ['myApp.filters']) $scope.$eval(model + '=' + lastUpdValue); } - thumb.css('left', e.offsetX); + thumb.css('left', Math.max(0, e.offsetX - thumbWidth)); fill.css('width', e.offsetX); $($window).on('mousemove', onMouseMove); diff --git a/app/partials/desktop/audio_player.html b/app/partials/desktop/audio_player.html index bf755c1c..9b38ae36 100644 --- a/app/partials/desktop/audio_player.html +++ b/app/partials/desktop/audio_player.html @@ -30,11 +30,10 @@
\ No newline at end of file