From def892953aae7a16a1d0288e9916221774306118 Mon Sep 17 00:00:00 2001 From: Andrea Rendine Date: Tue, 16 Feb 2016 00:27:44 +0100 Subject: [PATCH] Cooldown time from graphics Not a problem of precision, but a width measurement issue. Fixed and restored to previous precision level. --- script/Button.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/Button.js b/script/Button.js index b72c965..4d92077 100644 --- a/script/Button.js +++ b/script/Button.js @@ -78,10 +78,10 @@ var Button = { return; } start = Math.min($SM.get(id), cd); - left = (start / cd).toFixed(3); + left = (start / cd).toFixed(4); break; case 'pause': - left = (btn.children('div.cooldown').width() / btn.width()).toFixed(3); + left = (btn.children('div.cooldown').width() / btn.innerWidth()).toFixed(4); start = cd * left; break; default: @@ -101,7 +101,7 @@ var Button = { if (Engine.options.doubleTime){ time /= 2; } - $('div.cooldown', btn).width(Math.floor(left * 100) +"%").animate({width: '0%'}, time * 1000, 'linear', function() { + $('div.cooldown', btn).width(left * 100 +"%").animate({width: '0%'}, time * 1000, 'linear', function() { Button.clearCooldown(btn, true); }); btn.addClass('disabled');