Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto scale the rendered canvas #28

Closed
ZJvandeWeg opened this issue Apr 30, 2024 · 3 comments · Fixed by #29
Closed

Auto scale the rendered canvas #28

ZJvandeWeg opened this issue Apr 30, 2024 · 3 comments · Fixed by #29
Assignees
Labels
task A piece of work that isn't necessarily tied to a specific Epic or Story.

Comments

@ZJvandeWeg
Copy link
Member

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

@ZJvandeWeg ZJvandeWeg added the task A piece of work that isn't necessarily tied to a specific Epic or Story. label Apr 30, 2024
@joepavitt joepavitt self-assigned this Apr 30, 2024
@joepavitt
Copy link
Contributor

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

Offset all x/y values at render:

  • Would mean we modify the undlerying objects, which I'm not a fan of
  • Difficult to maintain as so many places where we render the x/y values of a thing

Just applying a fixed SVG transform:

  • Simpler to maintain
  • However, we have zoom controls bound to the full window (including all tabs), which is the same level we want to apply the translate(). The translate() is dependent on each flow though, not the full collection which is where the zoom logic lives

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
Copy link
Contributor

Steve-Mcl commented Apr 30, 2024

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
Copy link
Contributor

demo video in the PR: #29 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task A piece of work that isn't necessarily tied to a specific Epic or Story.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants