Partial revert "Fix commit/view handling when dragging arcs"
Revert unintended formatting changes
This reverts commit f0988c3c5d
.
This commit is contained in:
parent
f0988c3c5d
commit
1cb1fd3516
|
@ -528,9 +528,8 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( theArc->GetAngle() + maxTangentDeviation >= ANGLE_180 )
|
if( theArc->GetAngle() + maxTangentDeviation >= ANGLE_180 )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format(
|
wxString msg = wxString::Format( _( "Unable to resize arc tracks of %s or greater." ),
|
||||||
_( "Unable to resize arc tracks of %s or greater." ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( ANGLE_180 - maxTangentDeviation ) );
|
||||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( ANGLE_180 - maxTangentDeviation ) );
|
|
||||||
frame()->ShowInfoBarError( msg );
|
frame()->ShowInfoBarError( msg );
|
||||||
|
|
||||||
return 0; // don't bother with > 180 degree arcs
|
return 0; // don't bother with > 180 degree arcs
|
||||||
|
@ -543,8 +542,8 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
controls->ShowCursor( true );
|
controls->ShowCursor( true );
|
||||||
controls->SetAutoPan( true );
|
controls->SetAutoPan( true );
|
||||||
|
|
||||||
BOARD_COMMIT commit( this );
|
BOARD_COMMIT commit( this );
|
||||||
bool restore_state = false;
|
bool restore_state = false;
|
||||||
|
|
||||||
commit.Modify( theArc );
|
commit.Modify( theArc );
|
||||||
|
|
||||||
|
@ -565,59 +564,60 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
std::set<PCB_TRACK*> addedTracks;
|
std::set<PCB_TRACK*> addedTracks;
|
||||||
|
|
||||||
auto getUniqueTrackAtAnchorCollinear = [&]( const VECTOR2I& aAnchor,
|
auto getUniqueTrackAtAnchorCollinear =
|
||||||
const SEG& aCollinearSeg ) -> PCB_TRACK*
|
[&]( const VECTOR2I& aAnchor, const SEG& aCollinearSeg ) -> PCB_TRACK*
|
||||||
{
|
{
|
||||||
std::shared_ptr<CONNECTIVITY_DATA> conn = board()->GetConnectivity();
|
std::shared_ptr<CONNECTIVITY_DATA> conn = board()->GetConnectivity();
|
||||||
|
|
||||||
// Allow items at a distance within the width of the arc track
|
// Allow items at a distance within the width of the arc track
|
||||||
int allowedDeviation = theArc->GetWidth();
|
int allowedDeviation = theArc->GetWidth();
|
||||||
|
|
||||||
std::vector<BOARD_CONNECTED_ITEM*> itemsOnAnchor;
|
std::vector<BOARD_CONNECTED_ITEM*> itemsOnAnchor;
|
||||||
|
|
||||||
for( int i = 0; i < 3; i++ )
|
for( int i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
itemsOnAnchor = conn->GetConnectedItemsAtAnchor(
|
itemsOnAnchor = conn->GetConnectedItemsAtAnchor( theArc, aAnchor,
|
||||||
theArc, aAnchor, { PCB_PAD_T, PCB_VIA_T, PCB_TRACE_T, PCB_ARC_T },
|
{ PCB_PAD_T, PCB_VIA_T,
|
||||||
allowedDeviation );
|
PCB_TRACE_T, PCB_ARC_T },
|
||||||
allowedDeviation /= 2;
|
allowedDeviation );
|
||||||
|
allowedDeviation /= 2;
|
||||||
|
|
||||||
if( itemsOnAnchor.size() == 1 )
|
if( itemsOnAnchor.size() == 1 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCB_TRACK* track = nullptr;
|
PCB_TRACK* track = nullptr;
|
||||||
|
|
||||||
if( itemsOnAnchor.size() == 1 && itemsOnAnchor.front()->Type() == PCB_TRACE_T )
|
if( itemsOnAnchor.size() == 1 && itemsOnAnchor.front()->Type() == PCB_TRACE_T )
|
||||||
{
|
{
|
||||||
track = static_cast<PCB_TRACK*>( itemsOnAnchor.front() );
|
track = static_cast<PCB_TRACK*>( itemsOnAnchor.front() );
|
||||||
commit.Modify( track );
|
commit.Modify( track );
|
||||||
|
|
||||||
SEG trackSeg( track->GetStart(), track->GetEnd() );
|
SEG trackSeg( track->GetStart(), track->GetEnd() );
|
||||||
|
|
||||||
// Allow deviations in colinearity as defined in ADVANCED_CFG
|
// Allow deviations in colinearity as defined in ADVANCED_CFG
|
||||||
if( trackSeg.Angle( aCollinearSeg ) > maxTangentDeviation )
|
if( trackSeg.Angle( aCollinearSeg ) > maxTangentDeviation )
|
||||||
track = nullptr;
|
track = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !track )
|
if( !track )
|
||||||
{
|
{
|
||||||
track = new PCB_TRACK( theArc->GetParent() );
|
track = new PCB_TRACK( theArc->GetParent() );
|
||||||
track->SetStart( aAnchor );
|
track->SetStart( aAnchor );
|
||||||
track->SetEnd( aAnchor );
|
track->SetEnd( aAnchor );
|
||||||
track->SetNet( theArc->GetNet() );
|
track->SetNet( theArc->GetNet() );
|
||||||
track->SetLayer( theArc->GetLayer() );
|
track->SetLayer( theArc->GetLayer() );
|
||||||
track->SetWidth( theArc->GetWidth() );
|
track->SetWidth( theArc->GetWidth() );
|
||||||
track->SetLocked( theArc->IsLocked() );
|
track->SetLocked( theArc->IsLocked() );
|
||||||
track->SetFlags( IS_NEW );
|
track->SetFlags( IS_NEW );
|
||||||
getView()->Add( track );
|
getView()->Add( track );
|
||||||
addedTracks.insert( track );
|
addedTracks.insert( track );
|
||||||
}
|
}
|
||||||
|
|
||||||
return track;
|
return track;
|
||||||
};
|
};
|
||||||
|
|
||||||
PCB_TRACK* trackOnStart = getUniqueTrackAtAnchorCollinear( theArc->GetStart(), tanStart );
|
PCB_TRACK* trackOnStart = getUniqueTrackAtAnchorCollinear( theArc->GetStart(), tanStart);
|
||||||
PCB_TRACK* trackOnEnd = getUniqueTrackAtAnchorCollinear( theArc->GetEnd(), tanEnd );
|
PCB_TRACK* trackOnEnd = getUniqueTrackAtAnchorCollinear( theArc->GetEnd(), tanEnd );
|
||||||
|
|
||||||
if( trackOnStart->GetLength() != 0 )
|
if( trackOnStart->GetLength() != 0 )
|
||||||
|
@ -636,13 +636,14 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
if( tanIntersect = tanStart.IntersectLines( tanEnd ); !tanIntersect )
|
if( tanIntersect = tanStart.IntersectLines( tanEnd ); !tanIntersect )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto isTrackStartClosestToArcStart = [&]( PCB_TRACK* aTrack ) -> bool
|
auto isTrackStartClosestToArcStart =
|
||||||
{
|
[&]( PCB_TRACK* aTrack ) -> bool
|
||||||
double trackStartToArcStart = GetLineLength( aTrack->GetStart(), theArc->GetStart() );
|
{
|
||||||
double trackEndToArcStart = GetLineLength( aTrack->GetEnd(), theArc->GetStart() );
|
double trackStartToArcStart = GetLineLength( aTrack->GetStart(), theArc->GetStart() );
|
||||||
|
double trackEndToArcStart = GetLineLength( aTrack->GetEnd(), theArc->GetStart() );
|
||||||
|
|
||||||
return trackStartToArcStart < trackEndToArcStart;
|
return trackStartToArcStart < trackEndToArcStart;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart );
|
bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart );
|
||||||
bool isEndTrackOnStartPt = isTrackStartClosestToArcStart( trackOnEnd );
|
bool isEndTrackOnStartPt = isTrackStartClosestToArcStart( trackOnEnd );
|
||||||
|
@ -674,18 +675,19 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
// * *
|
// * *
|
||||||
//
|
//
|
||||||
|
|
||||||
auto getFurthestPointToTanInterstect = [&]( VECTOR2I& aPointA, VECTOR2I& aPointB ) -> VECTOR2I
|
auto getFurthestPointToTanInterstect =
|
||||||
{
|
[&]( VECTOR2I& aPointA, VECTOR2I& aPointB ) -> VECTOR2I
|
||||||
if( ( aPointA - *tanIntersect ).EuclideanNorm()
|
{
|
||||||
> ( aPointB - *tanIntersect ).EuclideanNorm() )
|
if( ( aPointA - *tanIntersect ).EuclideanNorm()
|
||||||
{
|
> ( aPointB - *tanIntersect ).EuclideanNorm() )
|
||||||
return aPointA;
|
{
|
||||||
}
|
return aPointA;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
return aPointB;
|
{
|
||||||
}
|
return aPointB;
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
CIRCLE maxTanCircle;
|
CIRCLE maxTanCircle;
|
||||||
VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.A, tanStart.B );
|
VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.A, tanStart.B );
|
||||||
|
@ -789,7 +791,7 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
||||||
break; // Finish
|
break; // Finish
|
||||||
}
|
}
|
||||||
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT )
|
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT )
|
||||||
|| evt->IsDblClick( BUT_LEFT ) )
|
|| evt->IsDblClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
// Eat mouse-up/-click events that leaked through from the lock dialog
|
// Eat mouse-up/-click events that leaked through from the lock dialog
|
||||||
if( eatFirstMouseUp && !evt->IsAction( &ACTIONS::cursorClick ) )
|
if( eatFirstMouseUp && !evt->IsAction( &ACTIONS::cursorClick ) )
|
||||||
|
|
Loading…
Reference in New Issue