ctn-archive / nengo_gui_2014

HTML5 graphical interface for Nengo -- now obsolete! Please use https://github.com/nengo/nengo_gui instead
Other
6 stars 0 forks source link

Any script that doesn't already have positions defined breaks #41

Closed tcstewar closed 10 years ago

tcstewar commented 10 years ago

If you don't have nengo_gui positions defined in your script, you get all the nodes right on top of each other, and this sort of thing appears in the editor:

import nengo_gui
gui = nengo_gui.Config()
gui[model].scale = 1
gui[model].offset = 307,242
gui[a].pos = NaN, NaN
gui[a].scale = 1.000
gui[b].pos = NaN, NaN
gui[b].scale = 1.000
gui[c].pos = NaN, NaN
gui[c].scale = 1.000
gui[d].pos = 0.000, 0.000
gui[d].scale = 1.000
gui[e].pos = 0.000, 0.000
gui[e].scale = 1.000
gui[f].pos = NaN, NaN
gui[f].scale = 1.000
gui[g].pos = NaN, NaN
gui[g].scale = 1.000
celiasmith commented 10 years ago

The NaNs are now gone: 4239fef41ec0e56000c995b9aca1e37b77fadbcc However, it's still not obvious to do on loading such models. I toyed with automatically zoom and centering, and it works nicely. But, that would then happen every time you edit something. We could set some flag to indicate that there was no import gui command in the original script to trigger that zoomCenter call.

tcstewar commented 10 years ago

You should be able to just use the global_offset and global_scale parameters -- if those are set (they're the same as gui[model].scale and gui[model].offset). If the default were changed to null,null rather than 0,0, this would be straightforward to detect.

celiasmith commented 10 years ago

done f4a16d98c34875fc7e06302d3735fb05c6816951