therewasaguy / p5js-webIDE

demo ~
http://p5ide.herokuapp.com/
47 stars 11 forks source link

When first opening an editor view of a sketch should it run automatically? #76

Closed shiffman closed 8 years ago

shiffman commented 8 years ago

When I share a view like so:

http://p5ide.herokuapp.com/editor#?sketch=56899c0c66d9570300507582

Should the sketch run automatically or do I need to press "run"? My expectation is that it should run, but I'm not sure exactly what is right.

therewasaguy commented 8 years ago

I've gone back and forth on this.

If the user is set to run in a new window, then running automatically also involves opening a new window, and that's bad.

Maybe there can be an additional, optional param to the "share version" of the edit sketch url, like

"&autoplay=true"

which turns on runInFrame, and autoplays the sketch when the page loads.

shiffman commented 8 years ago

I like that idea. This also brings up the question. . . I wonder if the "run in a new window" should be a sketch by sketch preference and not a user preference. I like the idea of that though I guess it would require some sort of "project" settings which is maybe not something we want?

therewasaguy commented 8 years ago

With this, editor sketches won't automatically run in frame unless you add &autoplay=true to the url https://github.com/therewasaguy/p5js-webIDE/commit/ce91f4ec64a36867a8bf35e55f9a1ef34bc00635

For now, it also modifies the user settings to runInFrame. That's not a good long term solution. It would be better to run it in the frame just one time without changing the user's settings, but this gets complicated because the editor would somehow need to know to shift views automatically.

Project settings would be good to add at some point, but so far there are only user settings which is nice and simple.