bvaughn / react-resizable-panels

https://react-resizable-panels.vercel.app/
MIT License
3.87k stars 135 forks source link

Feature Request: Double Resize ➡️⬆️ #268

Closed BrodyRas closed 8 months ago

BrodyRas commented 8 months ago

Mimic the behavior of VS Code's panels: place a Double Resize Handle at the intersection of any two panels, allowing the user to resize both panels simultaneously

double

bvaughn commented 8 months ago

This would require rearchitecting how this library initiates a drag. Might be doable without a lot of work but might require significant changes. If the former I'd be willing to review a PR for it.

bvaughn commented 8 months ago

I think I have the resize behavior working:

https://github.com/bvaughn/react-resizable-panels/assets/29597/6e286fe0-74ec-4160-a057-a0f0f391ac6d

The cursor logic would need to be refactored to show the "move" cursor when hovering over an intersecting resize bar, but otherwise it seems like this may be doable without a large amount of refactoring.

lukasbash commented 8 months ago

Epic feature! Would need this too for nested group gutters.

bvaughn commented 8 months ago

Made a bit more progress this morning on this. Cursor styles are now accounting for intersecting panels.

Kapture 2024-01-28 at 12.20.40.webm

Need to sort out a few more things– mainly, how to update cursors if you've drag too far past a panel's min/max constraints, but I don't think that will be too much work.

bvaughn commented 8 months ago

Think I got it!

Kapture 2024-01-28 at 13.09.26.webm

BrodyRas commented 8 months ago

Outstanding work! Well done 😊

bvaughn commented 8 months ago

The approach I've built in #274 feels really good on my desktop, but the hit detection doesn't work well on my phone or tablet (touch devices). It's probably a stupid bug on my part, but I need to track it down before I could do a release.


Edit It was a silly mistake. I think I've sorted it out.

lukasbash commented 8 months ago

Insane work!! Would be awesome to have this released soon 🤩

bvaughn commented 8 months ago

This feature has been published in react-resizable-panels@2.0.0

Check it out yourself here: https://react-resizable-panels.vercel.app/examples/nested


❤️ → ☕ givebrian.coffee