Skip to content

Commit

Permalink
Make possible to disable continuous rendering animation
Browse files Browse the repository at this point in the history
  • Loading branch information
eriksson authored and Enet4 committed Oct 26, 2021
1 parent cb9ed32 commit ee17f7d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 10 additions & 4 deletions visualization/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,9 @@ X.renderer.prototype.render = function() {
//

// this starts the rendering loops and store its id
this._AnimationFrameID = window.requestAnimationFrame(this.render.bind(this));
this._AnimationFrameID = window.requestAnimationFrame((function(){
this._continuousRendering && this.render();
}).bind(this));
eval("this.onRender()");
this.render_(false, true);
eval("this.afterRender()");
Expand Down Expand Up @@ -1204,9 +1206,13 @@ X.renderer.prototype.afterRender = function() {
* @protected
*/
X.renderer.prototype.render_ = function(picking, invoked) {



if(picking && !this._continuousRendering){ // schedule a new rendering event
// stop the rendering loop
window.cancelAnimationFrame(this._AnimationFrameID);
// this starts the rendering loops and store its id
this._AnimationFrameID = window.requestAnimationFrame(this.render.bind(this));
}

};


Expand Down
14 changes: 14 additions & 0 deletions visualization/renderer3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ X.renderer3D = function () {
'INTERMEDIATE_RENDERING': false
};

this._continuousRendering = true;

};
// inherit from X.renderer
goog.inherits(X.renderer3D, X.renderer);
Expand All @@ -258,6 +260,18 @@ X.renderer3D.prototype.__defineGetter__('config', function () {

});

X.renderer3D.prototype.__defineGetter__('continuousRendering', function () {

return this._continuousRendering;

});

X.renderer3D.prototype.__defineSetter__('continuousRendering', function (v) {

this._continuousRendering = v;

});


/**
* Reset the global bounding box for all objects to undefined and reset the
Expand Down

0 comments on commit ee17f7d

Please sign in to comment.