7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 00:30:01 +00:00

SCH_TABLE and PCB_TABLE: fix incorrect plot of tables rotated 90 or -90 deg.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19985
This commit is contained in:
jean-pierre charras 2025-02-18 17:55:57 +01:00
parent 6ecac5d2e6
commit 276029ee03
2 changed files with 27 additions and 6 deletions

View File

@ -546,16 +546,29 @@ void SCH_TABLE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
if( GetBorderStroke().GetWidth() >= 0 )
{
setupStroke( GetBorderStroke() );
SCH_TABLECELL* cell = GetCell( 0, 0 );
if( StrokeHeader() )
{
SCH_TABLECELL* cell = GetCell( 0, 0 );
aPlotter->MoveTo( VECTOR2I( pos.x, cell->GetEndY() ) );
aPlotter->FinishTo( VECTOR2I( end.x, cell->GetEndY() ) );
}
if( !cell->GetTextAngle().IsHorizontal() )
{
aPlotter->MoveTo( VECTOR2I( cell->GetEndX(), pos.y ) );
aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
}
else
{
aPlotter->MoveTo( VECTOR2I( pos.x, cell->GetEndY() ) );
aPlotter->FinishTo( VECTOR2I( end.x, cell->GetEndY() ) );
}
}
if( StrokeExternal() )
{
RotatePoint( pos, GetPosition(), cell->GetTextAngle() );
RotatePoint( end, GetPosition(), cell->GetTextAngle() );
aPlotter->Rect( pos, end, FILL_T::NO_FILL, lineWidth );
}
}
}

View File

@ -1189,15 +1189,23 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
if( aTable->GetBorderStroke().GetWidth() >= 0 )
{
setupStroke( aTable->GetBorderStroke() );
PCB_TABLECELL* cell = aTable->GetCell( 0, 0 );
if( aTable->StrokeHeader() )
{
PCB_TABLECELL* cell = aTable->GetCell( 0, 0 );
strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
if( !cell->GetTextAngle().IsHorizontal() )
strokeLine( VECTOR2I( cell->GetEndX(), pos.y ), VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
else
strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
}
if( aTable->StrokeExternal() )
{
RotatePoint( pos, aTable->GetPosition(), cell->GetTextAngle() );
RotatePoint( end, aTable->GetPosition(), cell->GetTextAngle() );
strokeRect( pos, end );
}
}
}