layout: implement table rowspan geometry (#357)#361
Merged
Conversation
Rowspan was stored and used only to reserve grid occupancy so following rows skipped the spanned columns. The vertical geometry was never implemented: a spanning cell contributed height to its starting row only and was always drawn one row tall, so it appeared as a single row. Add spanHeight to gridCell (the vertical analogue of spanWidth). In buildGrid, exclude rowspanning cells from their starting row's natural height, then resolve span heights in a second pass: sum the spanned rows' heights plus the inter-row spacing gaps, growing the last spanned row when the cell's content needs more room. drawTableRowDirect draws spanning cells at spanHeight; vertical alignment already keys off the height arg, so content centers across the full span. A rowspan that straddles a page break is not yet handled (the split logic is span-unaware); documented as a known limitation.
301cdcc to
3c89142
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #357.
Problem
rowspanwas stored and used only to reserve grid occupancy so following rows skipped the spanned columns. The vertical geometry was never implemented: a spanning cell contributed height to its starting row only and was always drawn one row tall, so it appeared as a single row.Fix
spanHeighttogridCell(the vertical analogue ofspanWidth).buildGrid, exclude rowspanning cells from their starting row's natural height, then resolve span heights in a second pass: sum the spanned rows' heights plus the inter-row spacing gaps, growing the last spanned row when the cell's content needs more room.drawTableRowDirectdraws spanning cells atspanHeight. Vertical alignment already keys off the height argument, so content centers across the full span.Preview
The new
examples/table-rowspandemo (issue's minimal case + a 3-row schedule grid):Tests
TestTableRowspan— span covers both rows; non-spanning sibling hasspanHeight == 0.TestTableRowspanIncludesVerticalSpacing— span includes the inter-row gap.TestTableRowspanDeficitGrowsLastRow— tall content grows the last spanned row.TestTableRowspanThreeRows— 3-row span covers all rows plus both gaps.TestTableColspanAndRowspanCombined— width and height span independently.Known limitation
A rowspan that straddles a page break is not yet handled —
PlanLayout's split logic is span-unaware, so such a cell draws its full height past the page bottom. Documented in a code comment; tracked in #362.