Skip to content

Commit f58dab1

Browse files
authored
Merge pull request goldfire#1045 from Megabyteceer/master
.volume() is wrong after fade
2 parents 2080398 + c37975a commit f58dab1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/howler.core.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,11 @@
13541354
vol += diff * tick;
13551355

13561356
// Make sure the volume is in the right bounds.
1357-
vol = Math.max(0, vol);
1358-
vol = Math.min(1, vol);
1357+
if(diff < 0) {
1358+
vol = Math.max(to, vol);
1359+
} else {
1360+
vol = Math.min(to, vol);
1361+
}
13591362

13601363
// Round to within 2 decimal points.
13611364
vol = Math.round(vol * 100) / 100;
@@ -1377,7 +1380,7 @@
13771380
clearInterval(sound._interval);
13781381
sound._interval = null;
13791382
sound._fadeTo = null;
1380-
self.volume(to, sound._id);
1383+
self.volume(to, sound._id); //does this line has a sense now?
13811384
self._emit('fade', sound._id);
13821385
}
13831386
}, stepLen);

0 commit comments

Comments
 (0)