Spaces:
Sleeping
Pane resize: dynamically clamp to keep canvas usable
Browse filesEarlier fix (3fa3c35) suppressed transition during drag and added
overflow-x-hidden on the asides — that handled the visual lag, but
not the underlying issue. Real cause:
NodePalette tiles are each fixed at 108px wide and shrink-0. When a
side pane is dragged so wide that <main> shrinks below ~108px, tiles
overflow main horizontally and visually escape into the side pane,
showing through (or on top of) the Results card. The aside's
overflow clip didn't help because the bleed source was main, not the
aside.
Fix:
1. Dynamic clamp in both PaneResizer onResize callbacks: never let
the dragged pane push the canvas below MIN_CANVAS_W (=280px),
accounting for the other pane's footprint and both resizers.
2. overflow-x-hidden on <main> as a defensive belt — anything that
does try to overflow the canvas column horizontally now gets
clipped instead of bleeding into the side panes.
3. Window-resize listener that retroactively shrinks panes which
were saved at widths the smaller viewport can't accommodate;
without it, opening the app in a smaller window would re-trigger
the bug from saved localStorage values.
- frontend/src/App.tsx +69 -6
|
@@ -22,6 +22,16 @@ const RIGHT_MIN = 300;
|
|
| 22 |
const RIGHT_MAX = 720;
|
| 23 |
const COLLAPSED_W = 32;
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
const LS_LEFT = "jqub.leftPaneWidth";
|
| 26 |
const LS_RIGHT = "jqub.rightPaneWidth";
|
| 27 |
const LS_LEFT_COLLAPSED = "jqub.leftPaneCollapsed";
|
|
@@ -149,6 +159,34 @@ export default function App() {
|
|
| 149 |
}
|
| 150 |
}, [isDesktop]);
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
useEffect(() => {
|
| 153 |
api
|
| 154 |
.health()
|
|
@@ -192,14 +230,28 @@ export default function App() {
|
|
| 192 |
{!leftCollapsed && (
|
| 193 |
<PaneResizer
|
| 194 |
onResize={(dx) =>
|
| 195 |
-
setLeftW((w) =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
}
|
| 197 |
onDoubleClick={() => setLeftW(LEFT_DEFAULT)}
|
| 198 |
onDragChange={setIsResizing}
|
| 199 |
ariaLabel="Resize pipeline input pane"
|
| 200 |
/>
|
| 201 |
)}
|
| 202 |
-
<main className="flex-1 min-w-0 flex flex-col min-h-0">
|
| 203 |
<NodePalette />
|
| 204 |
<ReactFlowProvider>
|
| 205 |
<FlowCanvas />
|
|
@@ -208,9 +260,20 @@ export default function App() {
|
|
| 208 |
{!rightCollapsed && (
|
| 209 |
<PaneResizer
|
| 210 |
onResize={(dx) =>
|
| 211 |
-
setRightW((w) =>
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
}
|
| 215 |
onDoubleClick={() => setRightW(RIGHT_DEFAULT)}
|
| 216 |
onDragChange={setIsResizing}
|
|
@@ -237,7 +300,7 @@ export default function App() {
|
|
| 237 |
) : (
|
| 238 |
/* ===================== Mobile ====================== */
|
| 239 |
<div className="flex-1 flex flex-col min-h-0">
|
| 240 |
-
<main className="flex-1 min-w-0 flex flex-col min-h-0">
|
| 241 |
<NodePalette />
|
| 242 |
<ReactFlowProvider>
|
| 243 |
<FlowCanvas />
|
|
|
|
| 22 |
const RIGHT_MAX = 720;
|
| 23 |
const COLLAPSED_W = 32;
|
| 24 |
|
| 25 |
+
// Minimum width we ever want to leave for the canvas (NodePalette + React
|
| 26 |
+
// Flow). Below this, NodePalette tiles (each fixed at 108px and shrink-0)
|
| 27 |
+
// start overflowing horizontally because `<main>` has no overflow clip —
|
| 28 |
+
// they visually escape the canvas column and cover whatever's in the
|
| 29 |
+
// right pane. The dynamic clamp in the resize handler caps the side
|
| 30 |
+
// panes so this never happens, regardless of viewport size.
|
| 31 |
+
const MIN_CANVAS_W = 280;
|
| 32 |
+
// Reserve the side resizer's footprint when computing the canvas budget.
|
| 33 |
+
const RESIZER_W = 4;
|
| 34 |
+
|
| 35 |
const LS_LEFT = "jqub.leftPaneWidth";
|
| 36 |
const LS_RIGHT = "jqub.rightPaneWidth";
|
| 37 |
const LS_LEFT_COLLAPSED = "jqub.leftPaneCollapsed";
|
|
|
|
| 159 |
}
|
| 160 |
}, [isDesktop]);
|
| 161 |
|
| 162 |
+
// Window resize → shrink oversized panes back into the safe zone.
|
| 163 |
+
// The drag-time clamp keeps users from making things too wide; this
|
| 164 |
+
// covers the case where the user shrinks the window after panes were
|
| 165 |
+
// already wide. Without it, current widths could exceed the dynamic
|
| 166 |
+
// max for the new viewport, and NodePalette tiles would overflow into
|
| 167 |
+
// the side panes again.
|
| 168 |
+
useEffect(() => {
|
| 169 |
+
if (!isDesktop) return;
|
| 170 |
+
const onResize = () => {
|
| 171 |
+
const ww = window.innerWidth;
|
| 172 |
+
const leftFoot = leftCollapsed ? COLLAPSED_W : 0; // pane footprint computed below
|
| 173 |
+
const rightFoot = rightCollapsed ? COLLAPSED_W : 0;
|
| 174 |
+
// Headroom each pane has, given the *other* pane and resizers.
|
| 175 |
+
const maxLeft = Math.min(
|
| 176 |
+
LEFT_MAX,
|
| 177 |
+
ww - (rightCollapsed ? rightFoot : rightW + RESIZER_W) - RESIZER_W - MIN_CANVAS_W,
|
| 178 |
+
);
|
| 179 |
+
const maxRight = Math.min(
|
| 180 |
+
RIGHT_MAX,
|
| 181 |
+
ww - (leftCollapsed ? leftFoot : leftW + RESIZER_W) - RESIZER_W - MIN_CANVAS_W,
|
| 182 |
+
);
|
| 183 |
+
setLeftW((w) => Math.max(LEFT_MIN, Math.min(w, Math.max(LEFT_MIN, maxLeft))));
|
| 184 |
+
setRightW((w) => Math.max(RIGHT_MIN, Math.min(w, Math.max(RIGHT_MIN, maxRight))));
|
| 185 |
+
};
|
| 186 |
+
window.addEventListener("resize", onResize);
|
| 187 |
+
return () => window.removeEventListener("resize", onResize);
|
| 188 |
+
}, [isDesktop, leftCollapsed, rightCollapsed, leftW, rightW]);
|
| 189 |
+
|
| 190 |
useEffect(() => {
|
| 191 |
api
|
| 192 |
.health()
|
|
|
|
| 230 |
{!leftCollapsed && (
|
| 231 |
<PaneResizer
|
| 232 |
onResize={(dx) =>
|
| 233 |
+
setLeftW((w) => {
|
| 234 |
+
// Dynamic upper bound: never push left pane so wide that
|
| 235 |
+
// the canvas falls below MIN_CANVAS_W. Account for the
|
| 236 |
+
// right pane's current footprint (collapsed strip when
|
| 237 |
+
// collapsed, full width otherwise) and both resizers.
|
| 238 |
+
const rightFoot = rightCollapsed ? COLLAPSED_W : rightW + RESIZER_W;
|
| 239 |
+
const dynamicMax = Math.min(
|
| 240 |
+
LEFT_MAX,
|
| 241 |
+
window.innerWidth - rightFoot - RESIZER_W - MIN_CANVAS_W,
|
| 242 |
+
);
|
| 243 |
+
return Math.min(
|
| 244 |
+
Math.max(LEFT_MIN, dynamicMax),
|
| 245 |
+
Math.max(LEFT_MIN, w + dx),
|
| 246 |
+
);
|
| 247 |
+
})
|
| 248 |
}
|
| 249 |
onDoubleClick={() => setLeftW(LEFT_DEFAULT)}
|
| 250 |
onDragChange={setIsResizing}
|
| 251 |
ariaLabel="Resize pipeline input pane"
|
| 252 |
/>
|
| 253 |
)}
|
| 254 |
+
<main className="flex-1 min-w-0 flex flex-col min-h-0 overflow-x-hidden">
|
| 255 |
<NodePalette />
|
| 256 |
<ReactFlowProvider>
|
| 257 |
<FlowCanvas />
|
|
|
|
| 260 |
{!rightCollapsed && (
|
| 261 |
<PaneResizer
|
| 262 |
onResize={(dx) =>
|
| 263 |
+
setRightW((w) => {
|
| 264 |
+
// Dynamic upper bound: never push right pane so wide
|
| 265 |
+
// that the canvas falls below MIN_CANVAS_W. Mirror
|
| 266 |
+
// logic of the left resizer.
|
| 267 |
+
const leftFoot = leftCollapsed ? COLLAPSED_W : leftW + RESIZER_W;
|
| 268 |
+
const dynamicMax = Math.min(
|
| 269 |
+
RIGHT_MAX,
|
| 270 |
+
window.innerWidth - leftFoot - RESIZER_W - MIN_CANVAS_W,
|
| 271 |
+
);
|
| 272 |
+
return Math.min(
|
| 273 |
+
Math.max(RIGHT_MIN, dynamicMax),
|
| 274 |
+
Math.max(RIGHT_MIN, w - dx),
|
| 275 |
+
);
|
| 276 |
+
})
|
| 277 |
}
|
| 278 |
onDoubleClick={() => setRightW(RIGHT_DEFAULT)}
|
| 279 |
onDragChange={setIsResizing}
|
|
|
|
| 300 |
) : (
|
| 301 |
/* ===================== Mobile ====================== */
|
| 302 |
<div className="flex-1 flex flex-col min-h-0">
|
| 303 |
+
<main className="flex-1 min-w-0 flex flex-col min-h-0 overflow-x-hidden">
|
| 304 |
<NodePalette />
|
| 305 |
<ReactFlowProvider>
|
| 306 |
<FlowCanvas />
|