7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 14:50:11 +00:00

Allow DRC markers to be selected with area selection

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19258
This commit is contained in:
JamesJCode 2024-12-08 14:09:22 +00:00
parent 603c793f7e
commit 29798a6400
5 changed files with 27 additions and 4 deletions

View File

@ -106,6 +106,17 @@ bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) c
}
bool MARKER_BASE::HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy ) const
{
const BOX2I bbox = GetBoundingBoxMarker().GetInflated( aAccuracy );
if( aContained )
return aRect.Contains( bbox );
return aRect.Intersects( bbox );
}
void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale ) const
{
if( aScale < 0 )

View File

@ -119,6 +119,11 @@ public:
*/
bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;
/**
* Test if the given BOX2I intersects or contains the bounds of this object
*/
bool HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const;
/**
* Return the orthogonal, bounding box of this object for display purposes.
*

View File

@ -703,11 +703,11 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetLayerDisplayOnly( LAYER_RATSNEST );
m_view->SetLayerTarget( LAYER_DRC_ERROR, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_DRC_ERROR );
//m_view->SetLayerDisplayOnly( LAYER_DRC_ERROR );
m_view->SetLayerTarget( LAYER_DRC_WARNING, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_DRC_WARNING );
//m_view->SetLayerDisplayOnly( LAYER_DRC_WARNING );
m_view->SetLayerTarget( LAYER_DRC_EXCLUSION, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_DRC_EXCLUSION );
//m_view->SetLayerDisplayOnly( LAYER_DRC_EXCLUSION );
m_view->SetLayerTarget( LAYER_MARKER_SHADOWS, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_MARKER_SHADOWS );
m_view->SetLayerTarget( LAYER_DRC_SHAPE1, KIGFX::TARGET_OVERLAY );

View File

@ -82,6 +82,14 @@ public:
return HitTestMarker( aPosition, aAccuracy );
}
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override
{
if( GetMarkerType() == MARKER_RATSNEST )
return false;
return HitTestMarker( aRect, aContained, aAccuracy );
}
EDA_ITEM* Clone() const override
{
return new PCB_MARKER( *this );

View File

@ -1163,7 +1163,6 @@ bool PCB_SELECTION_TOOL::selectMultiple()
{
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( candidate.first );
if( item && Selectable( item ) && item->HitTest( selectionRect, !greedySelection )
&& ( greedySelection || !group_items.count( item ) ) )
{