react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Zoom to fit

Open will-stone opened this issue 9 years ago • 4 comments

I'm wondering if there's a way to auto zoom the diagram to the canvas size? Fitting all the nodes and links into the frame. Thanks.

will-stone avatar May 09 '17 08:05 will-stone

Hi there!

I implemented zoom to fit, please see example:

https://github.com/JokerNN/react-diagrams/commit/5b235238cf8454bcd57be70b525a7b5a1e2513ae

I don't know if it's necessary to have as a part of library though because there's a some nuances. (For example what to count as a top left corner of diagram, (0, 0) or most top-left node?)

Also I faced issue #109 . So used key workaround

JokerNN avatar Nov 16 '17 11:11 JokerNN

hey man, can you open up a PR 👍

dylanvorster avatar Nov 19 '17 13:11 dylanvorster

@dylanvorster for sure! I just wanted to deal with listeners problem first

JokerNN avatar Nov 20 '17 10:11 JokerNN

@JokerNN how would be the implementation considering the most top-left node? I think is better than considering (0,0)

matheusgaya avatar Mar 09 '18 14:03 matheusgaya