-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins and drawing #12
Comments
It sounds like there are two issues here. For the first one, I'm not sure exactly what you mean; the timer is managed via d3, and should be implemented by rAF in the default case (assuming it's available). That said, I'm not opposed to making the implementation more flexible. For the second one, do you have an example of a situation where the plugins were incorrectly initialized? |
I was thinking about something like the below, where the 500ms should be adjustable. var doDrawLoop = function ( planet, canvas, hooks ) {
timerRef = setInterval ( function ( ) {
if (planet.stopped) {
clearInterval ( timerRef );
timerRef = null;
return;
}
function doIt ( ) {
planet.context.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < hooks.onDraw.length; i++) {
hooks.onDraw[i]();
}
}
if ( typeof window.requestAnimationFrame !== 'undefined' ) {
window.requestAnimationFrame ( doIt );
}
else {
doIt ( );
}
}, 500 );
}; The second one, when you call
and re-add the plugins again. Hope that helps. |
I'm still not sure I fully follow your example's rAF usage, but I agree that it would be nice to allow for customization of the draw timer. I've opened #13 to change this. The first time you call |
Ah if this is expected, may I suggest to rename the function, maybe initPlanet or similar. If you leave the function 'draw', then it should only do somthing like: BTW, I like your project. Quite nice. Thanks |
The top of planetary.js holds doDrawLoop. It would be very valuable if one could refine it such that you specify a timeout after which you call requestAnimationFrame instead. This will decrease the load for complex web based applications.
Also I think the startDraw function has a bug. The folowing code should not belong in there. It may be neccesary to init the plugins separate from the stopped state.
if (planet.stopped !== true) {
initPlugins(planet, localPlugins);
}
I had > 100 plugins after a few minutes and the whole system came to a crawl. I fixed it by calling
globe.stop ( );
globe.draw ( canvas );
anytime
The text was updated successfully, but these errors were encountered: