Skip to content

Conversation

@mcollina
Copy link
Member

Summary

Fixed a critical bug where top flamegraph bars would disappear during pan/zoom operations when the window was in fullscreen or when content fit within the viewport in fixed-height mode.

Root Cause

In CameraController.ts, the #calculateBoundedPosition() method had a gap in its conditional logic:

  • When #isFixedHeight was true but isScrollable() was false (content fits in viewport)
  • Neither the if nor the else if branch executed
  • This left camera.y unconstrained
  • During pan/zoom operations, camera.y could become negative, pushing top frames off screen

The Fix

Changed the conditional in the vertical bounds calculation from:

} else if (!this.#isFixedHeight) {

to:

} else {

This ensures that camera.y is always constrained to 0 when vertical scrolling isn't needed, preventing top frames from disappearing.

Testing

Added two comprehensive regression tests in tests/edge-cases.spec.ts:

  1. Test for drag operations in fixed height mode - Verifies that dragging doesn't cause top frames to disappear when content fits in viewport
  2. Test for fullscreen resize scenarios - Ensures that resizing to fullscreen doesn't push frames off screen

Both tests include visual regression snapshots to catch any future regressions.

Files Changed

  • src/renderer/CameraController.ts - Fixed the bounds calculation logic
  • tests/edge-cases.spec.ts - Added 2 regression tests
  • tests/snapshots/edge-cases.spec.ts/ - 4 new snapshot files

Generated with Claude Code

Fixed a bug where top flamegraph bars would disappear during pan/zoom
operations when the window was in fullscreen or when content fit within
the viewport in fixed-height mode.

Root cause: In CameraController.ts, the calculateBoundedPosition() method
had a gap in its conditional logic. When isFixedHeight was true but
isScrollable() was false (content fits in viewport), neither branch
executed and camera.y remained unconstrained. This allowed camera.y to
become negative during pan/zoom operations, pushing top frames off screen.

Fix: Changed 'else if (!this.isFixedHeight)' to just 'else' in the
vertical bounds calculation, ensuring Y is always constrained to 0 when
vertical scrolling isn't needed.

Added two regression tests to prevent this issue from recurring:
- Test for drag operations in fixed height mode
- Test for fullscreen resize scenarios
@mcollina mcollina closed this Dec 24, 2025
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