Add documentation and remove dontSwitch parameter, since it will also receive the time as defined for requestAnimationFrame() callback.

This commit is contained in:
Jürg Lehni 2011-05-15 23:50:53 +01:00
parent 535e5fc5fc
commit 5bc2889f1c

View file

@ -178,6 +178,13 @@ var DocumentView = this.DocumentView = Base.extend({
*/
onResize: null,
/**
* Handler to be called on each frame of an animation.
*/
getOnFrame: function() {
return this._onFrame;
},
setOnFrame: function(onFrame) {
this._onFrame = onFrame;
var that = this,
@ -185,13 +192,13 @@ var DocumentView = this.DocumentView = Base.extend({
before,
time = 0,
count = 0;
function frame(dontSwitch) {
function frame() {
if (!that._onFrame) {
running = false;
return;
}
if (!dontSwitch)
paper = that._document._scope;
// Set the global paper object to the current scope
paper = that._document._scope;
// Request next frame already
DomEvent.requestAnimationFrame(frame, that._canvas);
running = true;
@ -209,11 +216,7 @@ var DocumentView = this.DocumentView = Base.extend({
// Call the onFrame handler straight away, initializing the sequence
// of onFrame calls.
if (!running)
frame(true);
},
getOnFrame: function() {
return this._onFrame;
frame();
},
_createEvents: function() {