LearnNewsExamplesServices
Frontmatter
id9457
titleGrid: Implement Mathematical Column Layout Engine
stateClosed
labels
enhancementaigrid
assigneestobiu
createdAtMar 13, 2026, 11:26 AM
updatedAtMar 16, 2026, 12:00 PM
githubUrlhttps://github.com/neomjs/neo/issues/9457
authortobiu
commentsCount1
parentIssue9456
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 16, 2026, 12:00 PM

Grid: Implement Mathematical Column Layout Engine

Closed v12.1.0 enhancementaigrid
tobiu
tobiu commented on Mar 13, 2026, 11:26 AM

This is a sub-task of Epic #9456 (Buffered Grid - High-Performance Locked Columns).

Context: Currently, grid.header.Toolbar#passSizeToBody calculates column x positions by calling getDomRect on the header items. This poses a problem for locked columns using CSS transforms (transform: translateX). getDomRect will return the visually transformed layout coordinates, breaking the logical representation of the Grid's layout state.

Task: Refactor the column layout calculation in GridContainer / HeaderToolbar so that columnPositions.x is calculated mathematically.

  • Logical X should equal the sum of the widths (including borders/margins) of all preceding columns in the items array.
  • This entirely decouples logical x layout from visual CSS states and avoids the need for asynchronous getDomRect queries on individual header buttons, improving startup performance.

Note: The Container width and Toolbar height/width still need to be measured once for container sizing.

tobiu added parent issue #9456 on Mar 13, 2026, 11:26 AM
tobiu added the enhancement label on Mar 13, 2026, 11:26 AM
tobiu added the grid label on Mar 13, 2026, 11:26 AM
tobiu added the ai label on Mar 13, 2026, 11:26 AM
tobiu assigned to @tobiu on Mar 13, 2026, 11:26 AM
tobiu referenced in commit 9e67aca - "Grid: Implement Mathematical Column Layout Engine (#9457)" on Mar 16, 2026, 11:53 AM
tobiu
tobiu Mar 16, 2026, 11:54 AM

Input from Gemini 3.1 Pro:

✦ I have completed the initial implementation for this sub-task (#9457).

Changes Implemented:

  1. Mathematical Ordering: Refactored src/grid/Container.mjs -> createColumns() to intercept the columns configuration upon grid initialization. It physically sorts the column definitions based on their locked configuration (start -> unlocked -> end) before VDOM generation and header.Toolbar item creation. This guarantees that DOM structures inherently respect the locked ordering.
  2. Hybrid Layout Engine: Refactored src/grid/header/Toolbar.mjs -> passSizeToBody().
    • It now calculates logical X coordinates mathematically using currentX += width (ensuring coordinates aren't corrupted by CSS transforms used in pinning).
    • Optimization: It detects if any columns use dynamic sizing (flex or non-pixel values). If all columns are fixed-width, it bypasses the getDomRect layout check entirely for a faster, DOM-free render phase. If dynamic columns are present, it falls back to measuring the layout to calculate currentX.

This change lays the required mathematical foundation for the main thread pinning addon, as logical widths and X-coordinates are now correctly and efficiently parsed.

tobiu closed this issue on Mar 16, 2026, 12:00 PM
tobiu cross-referenced by #9456 on Mar 16, 2026, 1:25 PM