Skip to content

Commit

Permalink
adjust volume with mousewheel (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
constlhq authored and listen1 committed Feb 28, 2018
1 parent 3097bb6 commit 4ea3a1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,14 @@
};
});

app.directive('volumeWheel', function() {
return function (scope, element, attrs) {
element.bind('mousewheel', function(){
scope.adjustVolume(window.event.wheelDelta>0)
});
};
});

app.controller('PlayController', ['$scope', '$timeout','$log',
'$anchorScroll', '$location', 'angularPlayer', '$http',
'$httpParamSerializerJQLike','$rootScope', 'Notification',
Expand All @@ -659,6 +667,7 @@

$scope.scrobbleTrackId = null;
$scope.scrobbleTimer = new Timer();
$scope.adjustVolume = angularPlayer.adjustVolume;

function switchMode(mode){
//playmode 0:loop 1:shuffle 2:repeat one
Expand Down
2 changes: 1 addition & 1 deletion listen1.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ <h2>{{ currentPlaying.title }}</h2>
<a class="icn icn-list" title="列表(l)" ng-click="togglePlaylist()"></a>
</div>

<div class="volume-ctrl">
<div class="volume-ctrl" volume-wheel>
<a class="icn" ng-class="{ 'icn-vol-mute': mute, 'icn-vol': mute == false }" title="静音(m) 增大(u) 减少(d)" ng-click="toggleMuteStatus()"></a>
<div class="m-pbar volume" >
<div class="barbg" id="volumebar" mode="volume" draggable>
Expand Down

0 comments on commit 4ea3a1c

Please sign in to comment.