devbookhq/splitter

[FEATURE] Get current panel sizes

joejordan opened this issue · 3 comments

First off I just want to say thanks for a great library. I tried like 3 other splitter libraries before stumbling onto this one, and this one was the one that made the most sense from an implementation standpoint.

My feature request is that I would like to be able to save the position of the splitter to user settings, but I wasn't able to find an easy way to extract the current position of the splitter.

Perhaps a single function that can extract the current percentage of each panel, so that I can just feed those numbers to initialSizes upon form load.

There is a planned onDidResize callback for this use-case. See #3 for discussion.

As @martonlanga mentioned, implementing onDidResize should enable this. Hopefully, I'll have some time this weekend to look into this.

I just released v1.0.4 which exposes the onDidResize prop. Check out the example. Through this prop, you get an index of a gutter that was moved and all sizes of the Splitter.