Skip to content

Code review: matrix layout and export cropping fixes#21

Merged
byemaxx merged 1 commit intostagingfrom
copilot/sub-pr-16
Jan 8, 2026
Merged

Code review: matrix layout and export cropping fixes#21
byemaxx merged 1 commit intostagingfrom
copilot/sub-pr-16

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 7, 2026

Comprehensive review of PR #16 fixes for matrix visualization layout and export issues. All previous review feedback has been addressed through sub-PRs #17-#20.

Verified Fixes

Export cropping (js/utils/export-tools.js)

  • Width measurement fallback chain now properly validates rect.width before defaulting to 1
  • shrinkToContent condition extracted once, eliminating duplicate boolean coercion
  • Removed unnecessary explicit undefined initialization

ResizeObserver memory leak (js/renderers/comparison-renderer.js)

  • Observer lifecycle managed via comparison-renderer-store.js with proper disconnect on cleanup
  • Switched from observing document.body to matrixContainer for efficient, targeted resize detection
  • Magic number 0.92 extracted to MATRIX_FILL_RATIO_THRESHOLD with documented rationale

CSS consistency (css/comparison.css)

  • Standardized child combinator spacing: .comparison-matrix-grid > .matrix-cell.empty-cell:first-child

Architecture

The fixes maintain the wrapper/container pattern for adaptive layout:

// ResizeObserver adjusts alignment based on content width vs available space
const fillRatio = availableWidth > 0 ? (containerWidth / availableWidth) : 1;
const shouldAlignLeft = sidebarCollapsed
  ? (containerWidth > availableWidth)
  : ((containerWidth > availableWidth) || (fillRatio < MATRIX_FILL_RATIO_THRESHOLD));

Export strategy detects matrix mode and applies shrink-to-content to avoid capturing centered empty margins.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix matrix layout and export cropping Code review: matrix layout and export cropping fixes Jan 7, 2026
Copilot AI requested a review from byemaxx January 7, 2026 00:35
@byemaxx byemaxx marked this pull request as ready for review January 8, 2026 01:07
@byemaxx byemaxx merged commit 55da1f9 into staging Jan 8, 2026
1 check passed
@byemaxx byemaxx deleted the copilot/sub-pr-16 branch January 8, 2026 01:08
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