OpenFn / lightning

OpenFn/Lightning ⚡️ is the newest version of the OpenFn DPG and provides a web UI to visually manage complex workflow automation projects.
https://openfn.github.io/lightning/
GNU Lesser General Public License v3.0
126 stars 34 forks source link

Workflow diagram: contextual min zoom #2221

Open josephjclark opened 3 months ago

josephjclark commented 3 months ago

The workflow diagram has hard-coded min and max zoom levels, which means that you can only ever zoom in or out so far.

I would love a smart min zoom, where you can always zoom out to the point where the chart fits the canvas, but no further (well maybe 10% further)

That would mean that in small workflows it's impossible to zoom out so much that you can't see anything, but in big workflows we can guarantee we'll fit everything on screen (even if you can't really see it). And all without supporting "useless" zoom levels.

We should be a able to work this out, because we can calculate (at least approximately) the total size of the chart from the positional data. So if we know that the chart requires 1000x1000 pixels, we can scale the zoom level accordingly. We would need to work out what zoom:1 means in terms of chart size, and from there we should be able to figure out at least a roughty correct min zoom level.