From fa7bc9ded25325bc254f0180d436208498af98ac Mon Sep 17 00:00:00 2001 From: artemlvov Date: Mon, 6 Jul 2020 18:16:16 +0200 Subject: [PATCH] Fix: fading never resolves in some cases (fixes #1368) --- src/howler.core.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/howler.core.js b/src/howler.core.js index 0219dce5..3f628735 100644 --- a/src/howler.core.js +++ b/src/howler.core.js @@ -1362,6 +1362,9 @@ lastTick = Date.now(); vol += diff * tick; + // Round to within 2 decimal points. + vol = Math.round(vol * 100) / 100; + // Make sure the volume is in the right bounds. if (diff < 0) { vol = Math.max(to, vol); @@ -1369,9 +1372,6 @@ vol = Math.min(to, vol); } - // Round to within 2 decimal points. - vol = Math.round(vol * 100) / 100; - // Change the volume. if (self._webAudio) { sound._volume = vol;