eeschema: fix issue: Moving a hierarchical pin slightly move also other hierarchical pins

Fixes: lp:1808687
https://bugs.launchpad.net/kicad/+bug/1808687
This commit is contained in:
jean-pierre charras 2018-12-16 15:31:31 +01:00
parent 6a0319f6b7
commit 638b4384ec
1 changed files with 11 additions and 6 deletions

View File

@ -1272,20 +1272,25 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
{
if( !sheetPin.IsMoving() )
{
// For aesthetic reasons, the SHEET_PIN is drawn with a small offset
// of width / 2
int width = aSheet->GetPenSize();
wxPoint pt = sheetPin.GetTextPos();
wxPoint initial_pos = sheetPin.GetTextPos();
wxPoint offset_pos = initial_pos;
switch( sheetPin.GetEdge() )
{
case SCH_SHEET_PIN::SHEET_TOP_SIDE: pt.y -= width / 2; break;
case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: pt.y += width / 2; break;
case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: pt.x -= width / 2; break;
case SCH_SHEET_PIN::SHEET_LEFT_SIDE: pt.x += width / 2; break;
case SCH_SHEET_PIN::SHEET_TOP_SIDE: offset_pos.y -= width / 2; break;
case SCH_SHEET_PIN::SHEET_BOTTOM_SIDE: offset_pos.y += width / 2; break;
case SCH_SHEET_PIN::SHEET_RIGHT_SIDE: offset_pos.x -= width / 2; break;
case SCH_SHEET_PIN::SHEET_LEFT_SIDE: offset_pos.x += width / 2; break;
default: break;
}
sheetPin.SetTextPos(pt);
sheetPin.SetTextPos( offset_pos );
draw( static_cast<SCH_HIERLABEL*>( &sheetPin ), aLayer );
m_gal->DrawLine( offset_pos, initial_pos );
sheetPin.SetTextPos( initial_pos );
}
}
}