feat(web): tune carrot dwell + cap max zoom#134
Conversation
- STEP_DURATION_BASE 2500 -> 2900: pixel travel stays at 1800ms but the gap between steps grows from 700ms to 1100ms. Gives the destination node more breathing room after a carrot delivery so the eye can register where it landed before the next step lights up. - maxZoom 6 -> 5: 6x was so close the pixel-art sprites started to feel pixelated past the canvas's intended fidelity. Pulling it back keeps the zoom feel crisper at the upper end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR adds runtime-tunable auto-zoom maximum value for playback camera movement, increases the base autoplay step duration for timing adjustments, and declares the console debug hook in types. ChangesCanvas Zoom Tuning and Autoplay Timing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author feedback: 5x still felt too zoomed-in. 4x keeps headroom for reading text on small nodes without crossing into pixel-art mush. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lift maxZoom from a hard-coded literal to component state so a debug hook can change it from the browser console: __setMaxZoom(3) // tighter cap __setMaxZoom(8) // looser cap Same shape as the existing __flowSpeed debug hook. Cleared on unmount. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xyflow/react v12's ReactFlowInstance has no setMaxZoom method - only the JSX prop drives the scaleExtent. State-driven approach already covers it; the imperative call was a TypeScript error. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The state-only path didn't take effect at runtime - v12's maxZoom prop is documented as reactive but the d3-zoom scaleExtent wasn't updating live for this app's mounting setup. Pulling useStoreApi and calling state.setMaxZoom(n) directly bypasses the prop-driven update chain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author clarified: the cap they wanted lower is the per-step auto-zoom that fires during playback (moveTo(focusNodes, 0.5, 1.8)) - NOT the wheel-zoom maxZoom prop on ReactFlow. Reverting earlier mis-targeted edits and pointing the debug hook at the right knob. Changes: - Revert wheel maxZoom back to 6 (original). - Drop the useStoreApi import + state binding for wheel maxZoom. - New state `autoZoomMax` (default 1.4, down from 1.8). Drives the active-step moveTo() call. - `window.__setMaxZoom(n)` now updates autoZoomMax AND clears lastFocusKeyRef so the new value applies to the current step immediately on the next render. Added autoZoomMax to the focus useEffect deps so the camera re-positions when the cap changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User test confirmed the cap had no effect because the natural-fit zoom was already below it (scale = 0.435 on their flow). Switching semantics: __setMaxZoom(n) now forces the playback auto-zoom and the paused-overview zoom to EXACTLY n on the next focus apply, bypassing the bbox-fit calculation. Clamped to React Flow's scale extent [0.1, 6] so wild inputs don't break the viewport. Default behavior preserved when no override is set (autoZoomOverride = null) - the natural fit math still runs at 1.8 cap for play and 1.5 for overview. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User settled on 1.0 after live-tuning via __setMaxZoom. The bbox-fit calc routinely landed at fractional zooms (~0.4 for wide flows) that felt too far out for tight focus on a step's sender + receiver. Scoping: override only applies to the playing branch's moveTo call. The paused overview keeps its natural-fit calculation so the whole flow still frames correctly when you stop playback. __setMaxZoom hook stays in for further live tuning if 1.0 turns out to need iteration; safe to strip once locked in. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Two small UX tuning knobs on the canvas:
STEP_DURATION_BASE2500 → 2900 inuseFlowAnimation.ts. The pixel-active phase (carrot travelling along the edge) stays at 1800 ms; only the gap between steps grows — from 700 ms to 1100 ms. The destination node has more breathing room after a carrot delivery before the next step lights up.maxZoom6 → 5 inFlowCanvas.tsx. 6× was so close that the pixel-art sprites started feeling over-pixelated past the canvas's intended fidelity.Test plan
STEP_DURATION_BASE).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores