Commit f9cc325b authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew, 3D viewer: fix incorrect position of multiline texts.

parent 517ca83f
......@@ -295,7 +295,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount )
std::vector<wxPoint>& aPositions, int aLineCount ) const
{
wxPoint pos = m_Pos; // Position of first line of the
// multiline text according to
......
......@@ -275,7 +275,7 @@ public:
* for efficiency reasons
*/
void GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount );
std::vector<wxPoint>& aPositions, int aLineCount ) const;
/**
* Function Format
* outputs the object to \a aFormatter in s-expression form.
......
......@@ -290,22 +290,19 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
if( IsMultilineAllowed() )
{
wxPoint pos = GetTextPosition();
wxArrayString* list = wxStringSplit( GetText(), '\n' );
wxPoint offset;
std::vector<wxPoint> positions;
positions.reserve( list->Count() );
GetPositionsOfLinesOfMultilineText( positions, list->Count() );
offset.y = GetInterline();
RotatePoint( &offset, GetOrientation() );
for( unsigned i = 0; i<list->Count(); i++ )
for( unsigned ii = 0; ii < list->Count(); ii++ )
{
wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, color,
wxString txt = list->Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], color,
txt, GetOrientation(), size,
GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(),
true, addTextSegmToPoly );
pos += offset;
}
delete list;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment