projectmesa / mesa-viz-tornado

Apache License 2.0
2 stars 8 forks source link

Mechanism for changing the canvas size in a visualization #20

Open jdfoote opened 4 years ago

jdfoote commented 4 years ago

What's the problem this feature will solve?

The size of a canvas is set when a visualization is initialized and cannot be updated. Sometimes, the size of the grid can be an important part of the model and it would be nice to have a way to change it in the UI.

Describe the solution you'd like

I think that my suggestion is for the reset button to also reset the JS that draws the canvas, or maybe even to redraw the entire "elements" div. This would make it possible to make aspects of the display editable in the UI.

Additional context

A discussion about this was started on the mailing list at https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/projectmesa/5ln8Ip7oIFg/UWx2R3EhBwAJ with initial exploration done by Jared Norman.

Corvince commented 4 years ago

I am working on an alternative front-end that is based on a declarative visualization specification (PR projectmesa/mesa#718). That means you define what you want to visualize rather then how exactly it is visualized. This means it does infer the relevant model parameters and you can freely change the grid size. You can preview an example on Glitch (expand the slider on the left side, change grid size to something low and hit reset in the upper right corner. Then click on any blue cell for some extra fun.)

I am a bit behind my work on the feature tho, it is still missing proper documentation and at least some basic specification checking - so it might still take some time until it lands in mesa.

jdfoote commented 4 years ago

This seems like a nice approach with some important benefits.