diff --git a/src/load.js b/src/load.js index 39b1a3d5..c7850c2b 100644 --- a/src/load.js +++ b/src/load.js @@ -102,4 +102,12 @@ if (window.tests) { for (var i = 0; i < sources.length; i++) { document.write(''); + if (sources[i] == 'src/paper.js') { + // Activate paper.debug for code loaded through load.js, as we're in + // development mode. + document.write(''); + } } + diff --git a/src/util/Event.js b/src/util/Event.js index 071d6cab..6b508726 100644 --- a/src/util/Event.js +++ b/src/util/Event.js @@ -79,6 +79,7 @@ Event.requestAnimationFrame = new function() { var callbacks = [], fastRate = 1000 / 60, slowRate = 1000, + focused = true, timer; // Installs interval timer that checks all callbacks. This results in much @@ -103,19 +104,20 @@ Event.requestAnimationFrame = new function() { }, timeout); } - var focused = true; - Event.add(window, { - focus: function() { - focused = true; - // Switch to falst checkCallback calls while window is focused. - timer && setTimer(fastRate); - }, - blur: function() { - focused = false; - // Switch to slow checkCallback calls while window is blured. - timer && setTimer(slowRate); - } - }); + if (!paper.debug) { + Event.add(window, { + focus: function() { + focused = true; + // Switch to falst checkCallback calls while window is focused. + timer && setTimer(fastRate); + }, + blur: function() { + focused = false; + // Switch to slow checkCallback calls while window is blured. + timer && setTimer(slowRate); + } + }); + } return function(callback, element) { if (request)