FlowFuse / flow-renderer

Apache License 2.0
5 stars 0 forks source link

Auto scale the rendered canvas #28

Closed ZJvandeWeg closed 5 months ago

ZJvandeWeg commented 5 months ago

Description

When my flow starts say 150 pixels down, and 300 pixels to the right, the top left part of the SVG / canvas has an open space which is slightly awkward. It would be great of the view would shift the thing down.

Epic/Story

No response

joepavitt commented 5 months ago

Started to dig into this, thinking it would be straight forward, little more complicated as:

Offset all x/y values at render:

Just applying a fixed SVG transform:

The second option is definitely the way forward, just need to shuffle around some of the zoom logic to make pieces more easily accessible.

Steve-Mcl commented 5 months ago

I have this working locally - will be pushing soon

I scan the flow for min/max/x/y, compute distances, factor in the scale, then set the div scroll positions.

working very well.

i also save state so switching tabs doesnt keep losing your position.

Steve-Mcl commented 5 months ago

demo video in the PR: https://github.com/FlowFuse/flow-renderer/pull/29#issue-2272296060