Frontmatter
| id | 9457 |
| title | Grid: Implement Mathematical Column Layout Engine |
| state | Closed |
| labels | enhancementaigrid |
| assignees | tobiu |
| createdAt | Mar 13, 2026, 11:26 AM |
| updatedAt | Mar 16, 2026, 12:00 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9457 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 9456 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 16, 2026, 12:00 PM |
Grid: Implement Mathematical Column Layout Engine
tobiu added parent issue #9456 on Mar 13, 2026, 11:26 AM
tobiu assigned to @tobiu on Mar 13, 2026, 11:26 AM

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:
- Mathematical Ordering: Refactored
src/grid/Container.mjs -> createColumns()to intercept thecolumnsconfiguration upon grid initialization. It physically sorts the column definitions based on theirlockedconfiguration (start->unlocked->end) before VDOM generation andheader.Toolbaritem creation. This guarantees that DOM structures inherently respect the locked ordering.- 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 (
flexor non-pixel values). If all columns are fixed-width, it bypasses thegetDomRectlayout check entirely for a faster, DOM-free render phase. If dynamic columns are present, it falls back to measuring the layout to calculatecurrentX.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
This is a sub-task of Epic #9456 (Buffered Grid - High-Performance Locked Columns).
Context: Currently,
grid.header.Toolbar#passSizeToBodycalculates columnxpositions by callinggetDomRecton the header items. This poses a problem for locked columns using CSS transforms (transform: translateX).getDomRectwill return the visually transformed layout coordinates, breaking the logical representation of the Grid's layout state.Task: Refactor the column layout calculation in
GridContainer/HeaderToolbarso thatcolumnPositions.xis calculated mathematically.Logical Xshould equal the sum of the widths (including borders/margins) of all preceding columns in theitemsarray.xlayout from visual CSS states and avoids the need for asynchronousgetDomRectqueries on individual header buttons, improving startup performance.Note: The
Containerwidth andToolbarheight/width still need to be measured once for container sizing.