nomcopter / react-mosaic

A React tiling window manager
https://nomcopter.github.io/react-mosaic/
Other
4.39k stars 226 forks source link

Unhide MosaicActions.hide()? #159

Closed zning closed 3 years ago

zning commented 3 years ago

I used MosaicActions.hide() to hide a node, is there a way to unhide/undo this to make the element show again?

Thanks a lot!

on2air commented 3 years ago

similar need. Looks like it sets the splitPercentage to 0 but doesn't save the previous value to set it back later. I don't see a way to do this currently but also need this behavior.

nomcopter commented 3 years ago

You can just save the overall state or the state for that specific node and then reset it when you want to unhide it. You can do this by simply changing the value provided to Mosaic or using updateTree provided through context.

enzotar commented 2 years ago

Could you provide an example with the demo code? For instance, if I move window 3 around, move window 1 and close window 3, how can I restore window 3?

nomcopter commented 2 years ago

You can set the value passed to Mosaic at any time. Simply restore it to what it was before you closed it or any other value that includes window 3.