Minor adjustments to arc editing algorithms.

1) Don't snap center since it will be re-computed (most likely
off-grid) anyway.
2) Don't flip shape during initial drawing.
This commit is contained in:
Jeff Young 2019-06-29 19:56:07 +01:00
parent 232e21cb37
commit 09b07cd387
2 changed files with 9 additions and 4 deletions

View File

@ -334,8 +334,8 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const
if( ( normStart == nullPoint ) || ( normEnd == nullPoint ) || ( m_Radius == 0 ) )
{
wxLogDebug( wxT("Invalid arc drawing definition, center(%d, %d) \
start(%d, %d), end(%d, %d), radius %d" ),
wxLogDebug( wxT("Invalid arc drawing definition, center(%d, %d), start(%d, %d), "
"end(%d, %d), radius %d" ),
m_Pos.x, m_Pos.y, m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
m_ArcEnd.y, m_Radius );
return rect;
@ -491,7 +491,7 @@ void LIB_ARC::CalcEdit( const wxPoint& aPosition )
wxPoint c2 = m - d;
wxPoint test = ( m_editState == 4 ) ? aPosition : m_Pos;
m_Pos = ( GetLineLength( c1, test ) < GetLineLength( c2, test ) ) ? c1 : c2;
m_Pos = ( m_editState > 1 && GetLineLength( c1, test ) < GetLineLength( c2, test ) ) ? c1 : c2;
CalcRadiusAngles();
}

View File

@ -311,7 +311,12 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
modified = true;
}
m_editedPoint->SetPosition( controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ) );
bool snap = !evt->Modifier( MD_ALT );
if( item->Type() == LIB_ARC_T && getEditedPointIndex() == ARC_CENTER )
snap = false;
m_editedPoint->SetPosition( controls->GetCursorPosition( snap ) );
updateItem();
updatePoints();