7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 17:23:44 +00:00

Pcbnew: fix last row/col table painting

Use the exact same logic as in eeschema, where this already work
perfectly.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19226
This commit is contained in:
John Beard 2024-11-30 18:54:41 +08:00
parent 08b5992f04
commit c0db57ea93

View File

@ -2492,47 +2492,31 @@ void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer )
if( aTable->StrokeColumns() )
{
int x = pos.x;
for( int col = 0; col < aTable->GetColCount() - 1; ++col )
{
int y = pos.y;
for( int row = 0; row < aTable->GetRowCount(); ++row )
{
PCB_TABLECELL* cell = aTable->GetCell( row, col );
int rowHeight = aTable->GetRowHeight( row );
VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
strokeLine( VECTOR2I( x, y ), VECTOR2I( x, y + rowHeight ) );
y += rowHeight;
strokeLine( topRight, cell->GetEnd() );
}
x += aTable->GetColWidth( col );
}
}
if( aTable->StrokeRows() )
{
int y = pos.y;
for( int row = 0; row < aTable->GetRowCount() - 1; ++row )
{
int x = pos.x;
for( int col = 0; col < aTable->GetColCount(); ++col )
{
PCB_TABLECELL* cell = aTable->GetCell( row, col );
int colWidth = aTable->GetColWidth( col );
VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
strokeLine( VECTOR2I( x, y ), VECTOR2I( x + colWidth, y ) );
x += colWidth;
strokeLine( botLeft, cell->GetEnd() );
}
y += aTable->GetRowHeight( row );
}
}
}