Push m_forceMarkObstaclesMode down into the DRAGGER.
The existing flag was never read anyway, and it's only the DRAGGER that knows that the starting state is already colliding and that we need to force mark-obstacles mode. Fixes https://gitlab.com/kicad/code/kicad/-/issues/8641
This commit is contained in:
parent
708b42ea69
commit
a2f19ea6bb
|
@ -41,6 +41,7 @@ DRAGGER::DRAGGER( ROUTER* aRouter ) :
|
|||
m_dragStatus = false;
|
||||
m_currentMode = RM_MarkObstacles;
|
||||
m_freeAngleMode = false;
|
||||
m_forceMarkObstaclesMode = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,11 +113,16 @@ bool DRAGGER::startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg )
|
|||
m_draggedLine = m_world->AssembleLine( aSeg, &m_draggedSegmentIndex );
|
||||
m_lastDragSolution = m_draggedLine;
|
||||
|
||||
if( m_shove )
|
||||
if ( m_world->CheckColliding( &m_draggedLine ) )
|
||||
{
|
||||
m_shove->SetInitialLine( m_draggedLine );
|
||||
// If we're already in a state that violates DRC then there's not much we can do but
|
||||
// switch to mark obstacles mode (and ignore other DRC violation).
|
||||
m_forceMarkObstaclesMode = true;
|
||||
}
|
||||
|
||||
if( m_shove )
|
||||
m_shove->SetInitialLine( m_draggedLine );
|
||||
|
||||
auto distA = ( aP - aSeg->Seg().A ).EuclideanNorm();
|
||||
auto distB = ( aP - aSeg->Seg().B ).EuclideanNorm();
|
||||
|
||||
|
@ -153,6 +159,13 @@ bool DRAGGER::startDragArc( const VECTOR2D& aP, ARC* aArc )
|
|||
m_shove->SetInitialLine( m_draggedLine );
|
||||
m_mode = DM_ARC;
|
||||
|
||||
if ( m_world->CheckColliding( &m_draggedLine ) )
|
||||
{
|
||||
// If we're already in a state that violates DRC then there's not much we can do but
|
||||
// switch to mark obstacles mode (and ignore other DRC violation).
|
||||
m_forceMarkObstaclesMode = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -164,6 +177,13 @@ bool DRAGGER::startDragVia( VIA* aVia )
|
|||
|
||||
m_mode = DM_VIA;
|
||||
|
||||
if ( m_world->CheckColliding( aVia ) )
|
||||
{
|
||||
// If we're already in a state that violates DRC then there's not much we can do but
|
||||
// switch to mark obstacles mode (and ignore other DRC violation).
|
||||
m_forceMarkObstaclesMode = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -209,6 +229,7 @@ bool DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives )
|
|||
m_draggedItems.Clear();
|
||||
m_currentMode = Settings().Mode();
|
||||
m_freeAngleMode = (m_mode & DM_FREE_ANGLE);
|
||||
m_forceMarkObstaclesMode = false;
|
||||
m_lastValidPoint = aP;
|
||||
|
||||
m_mouseTrailTracer.Clear();
|
||||
|
@ -320,7 +341,7 @@ bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
|
|||
}
|
||||
}
|
||||
|
||||
if( Settings().AllowDRCViolations() )
|
||||
if( m_forceMarkObstaclesMode || Settings().AllowDRCViolations() )
|
||||
m_dragStatus = true;
|
||||
else
|
||||
m_dragStatus = !m_lastNode->CheckColliding( m_draggedItems );
|
||||
|
@ -718,7 +739,7 @@ bool DRAGGER::FixRoute()
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !m_dragStatus && !Settings().AllowDRCViolations() )
|
||||
if( !m_dragStatus && !Settings().AllowDRCViolations() && !m_forceMarkObstaclesMode )
|
||||
return false;
|
||||
|
||||
Router()->CommitRouting( node );
|
||||
|
@ -735,7 +756,7 @@ bool DRAGGER::Drag( const VECTOR2I& aP )
|
|||
|
||||
bool ret = false;
|
||||
|
||||
if( m_freeAngleMode )
|
||||
if( m_freeAngleMode || m_forceMarkObstaclesMode )
|
||||
{
|
||||
ret = dragMarkObstacles( aP );
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ private:
|
|||
|
||||
///< If true, moves the connection lines without maintaining 45 degrees corners
|
||||
bool m_freeAngleMode;
|
||||
bool m_forceMarkObstaclesMode;
|
||||
MOUSE_TRAIL_TRACER m_mouseTrailTracer;
|
||||
};
|
||||
|
||||
|
|
|
@ -189,16 +189,10 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM_SET aStartItems, int aDragM
|
|||
if( aStartItems.Count( ITEM::SOLID_T ) == aStartItems.Size() )
|
||||
{
|
||||
m_dragger = std::make_unique<COMPONENT_DRAGGER>( this );
|
||||
m_forceMarkObstaclesMode = true;
|
||||
m_state = DRAG_COMPONENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aDragMode & DM_FREE_ANGLE )
|
||||
m_forceMarkObstaclesMode = true;
|
||||
else
|
||||
m_forceMarkObstaclesMode = false;
|
||||
|
||||
m_dragger = std::make_unique<DRAGGER>( this );
|
||||
m_state = DRAG_SEGMENT;
|
||||
}
|
||||
|
@ -420,8 +414,6 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
|
|||
if( !isStartingPointRoutable( aP, aStartItem, aLayer ) )
|
||||
return false;
|
||||
|
||||
m_forceMarkObstaclesMode = false;
|
||||
|
||||
switch( m_mode )
|
||||
{
|
||||
case PNS_MODE_ROUTE_SINGLE:
|
||||
|
|
|
@ -248,7 +248,6 @@ private:
|
|||
ROUTER_IFACE* m_iface;
|
||||
|
||||
int m_iterLimit;
|
||||
bool m_forceMarkObstaclesMode = false;
|
||||
|
||||
ROUTING_SETTINGS* m_settings;
|
||||
SIZES_SETTINGS m_sizes;
|
||||
|
|
Loading…
Reference in New Issue