Skip to content

Commit

Permalink
web: add experimental support for responsive pane resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Dec 30, 2024
1 parent c8aff37 commit 1930073
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions apps/web/src/components/split-pane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,30 @@ export const SplitPane = React.forwardRef<

const [entry] = entries;
const newSize = entry.contentRect ? entry.contentRect[sizeName] : 0;

const delta = newSize - wrapSize.current;
if (delta === 0) return;

// TODO: responsiveness
// const nextSizes = [...sizes.current];
// const i = sizes.current.length - 1;
// const currentSize = sizes.current[i];
// const currentPaneLimits = paneLimitSizes.current[i];
// const prevPaneLimits = paneLimitSizes.current[i - 1];

// if (
// delta > 0 &&
// prevPaneLimits &&
// prevPaneLimits.max < Infinity &&
// nextSizes[i - 1] + delta <= prevPaneLimits.max
// ) {
// nextSizes[i - 1] += delta;
// } else if (delta < 0 && currentSize + delta <= currentPaneLimits.min) {
// nextSizes[i - 1] += delta;
// } else {
// nextSizes[i] += delta;
// }

wrapSize.current = newSize;
setSizes(sizes.current, wrapSize.current);
});
Expand Down

0 comments on commit 1930073

Please sign in to comment.