From ccf5dd70f6adcb48334c40471938df1840fa672b Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sun, 8 May 2011 18:44:33 +0100 Subject: [PATCH] PaperScript: call the onFrame handler straight away. --- src/util/PaperScript.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/util/PaperScript.js b/src/util/PaperScript.js index 121d0bd5..9b74a6a8 100644 --- a/src/util/PaperScript.js +++ b/src/util/PaperScript.js @@ -154,15 +154,18 @@ var PaperScript = this.PaperScript = new function() { DomEvent.requestAnimationFrame(frame, doc && doc.canvas); onFrame(); // Automatically redraw document each frame. - doc && doc.redraw(); - } - DomEvent.requestAnimationFrame(frame, doc && doc.canvas); + if (doc) + doc.redraw(); + }; + // Call the onFrame handler and redraw the document: + frame(); + } else { + // Automatically redraw document at the end. + if (doc) + doc.redraw(); } } catch (e) { } - // Automatically redraw document at the end. - if (doc) - doc.redraw(); return res; } }