HitTesting is the wrong place to do visibility checks.

This commit is contained in:
Jeff Young 2024-04-17 10:44:26 +01:00
parent caa18568e0
commit c842de24b9
2 changed files with 12 additions and 7 deletions

View File

@ -1204,8 +1204,7 @@ BITMAPS SCH_FIELD::GetMenuImage() const
bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
// Do not hit test hidden or empty fields. if( GetShownText( true ).IsEmpty() )
if( ( !IsVisible() && !IsForceVisible() ) || GetShownText( true ).IsEmpty() )
return false; return false;
BOX2I rect = GetBoundingBox(); BOX2I rect = GetBoundingBox();
@ -1232,8 +1231,7 @@ bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
bool SCH_FIELD::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const bool SCH_FIELD::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
{ {
// Do not hit test hidden fields. if( GetShownText( true ).IsEmpty() )
if( ( !IsVisible() && !IsForceVisible() ) || GetShownText( true ).IsEmpty() )
return false; return false;
if( m_flags & (STRUCT_DELETED | SKIP_STRUCT ) ) if( m_flags & (STRUCT_DELETED | SKIP_STRUCT ) )

View File

@ -2452,10 +2452,10 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
// Pin anchors have to be allowed for auto-starting wires. // Pin anchors have to be allowed for auto-starting wires.
if( aPos ) if( aPos )
{ {
EE_GRID_HELPER grid( m_toolMgr ); EE_GRID_HELPER grid( m_toolMgr );
GRID_HELPER_GRIDS pinGrid = grid.GetItemGrid( pin );
if( pin->IsPointClickableAnchor( grid.BestSnapAnchor( if( pin->IsPointClickableAnchor( grid.BestSnapAnchor( *aPos, pinGrid ) ) )
*aPos, grid.GetItemGrid( static_cast<const SCH_ITEM*>( aItem ) ) ) ) )
return true; return true;
} }
@ -2475,7 +2475,14 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
return false; return false;
case SCH_FIELD_T: // SCH_FIELD objects are not unit/body-style-specific. case SCH_FIELD_T: // SCH_FIELD objects are not unit/body-style-specific.
{
const SCH_FIELD* field = static_cast<const SCH_FIELD*>( aItem );
if( !field->IsVisible() && !( symEditFrame && symEditFrame->GetShowInvisibleFields() ) )
return false;
break; break;
}
case SCH_SHAPE_T: case SCH_SHAPE_T:
case SCH_TEXT_T: case SCH_TEXT_T: