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

Rewrite layout algorithm internals [draft] #182

Merged
merged 35 commits into from
Nov 12, 2023

Conversation

bvaughn
Copy link
Owner

@bvaughn bvaughn commented Aug 14, 2023

Support mix of percentage and pixel units within a group or panel.

<Panel
  defaultSizePixels={100}
  minSizePercentage={20}
  maxSizePercentage={50}
/>

@vercel
Copy link

vercel bot commented Aug 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-resizable-panels ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 12, 2023 4:05pm

@bvaughn
Copy link
Owner Author

bvaughn commented Aug 27, 2023

I made pretty good progress this weekend on migrating the React components to use the new utilities. One more weekend of this and I think I should be ready to publish a release.

@viveleroi
Copy link

How's this going?

I've realized a flaw in the "custom" pixel approach we're using currently (setting sizes by watching windows resize and using math to translate a pixel value into a percent const navCollapseSize = width > 0 ? (36 / width) * 100 : 0)

When the user resizes or collapses the panel, and then resizes the window, the current size needs to be recalculated. For example if they collapse our panel it needs to be exactly 36px. Say that translates to 1.85% of the screen width. When they shrink the window, the current size stays 1.85% so therefore shrinks below the 36px minimum.

I could write logic to recalculate the new percentage on windows resize and use the panel api to .resize() myself but if this is something that is already being addressed by this effort, I'd rather wait.

@bvaughn
Copy link
Owner Author

bvaughn commented Sep 14, 2023

Unfortunately no update since my last comment.

I've been busy with my day job, and also traveling a lot, and this remains an unpaid side project. I'll get to it when I can find the time and energy. No promises when that will be.

@bvaughn
Copy link
Owner Author

bvaughn commented Oct 21, 2023

Picking this back up today to see if I can make a little progress. I don't have a sense of how close to finished it is. There's some work (mostly in PanelGroup) to wire up callbacks and imperative API, then some testing, but maybe it's close. We'll see.

@bvaughn
Copy link
Owner Author

bvaughn commented Nov 5, 2023

Was traveling for most of October, in Japan for a few weeks, so I didn't do anything here, but I picked things back up this weekend and filled in some of the remaining TODO comments for tests. I'm getting closer but it's still several hours away from being complete. I think the biggest TODO I need to tackle is the ResizeObserver bit for PanelGroups with pixel based constraints. I haven't thought much about that one yet, but...otherwise the remaining DEV warning tests are probably straight forward enough.

@bvaughn
Copy link
Owner Author

bvaughn commented Nov 12, 2023

I believe all of the functionality has been ported, and all tests should be passing now. All that's left is for me to write the changelog entry with a few before/after code examples to help people update their components.

@bvaughn bvaughn marked this pull request as ready for review November 12, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants