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
{
// Do not hit test hidden or empty fields.
if( ( !IsVisible() && !IsForceVisible() ) || GetShownText( true ).IsEmpty() )
if( GetShownText( true ).IsEmpty() )
return false;
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
{
// Do not hit test hidden fields.
if( ( !IsVisible() && !IsForceVisible() ) || GetShownText( true ).IsEmpty() )
if( GetShownText( true ).IsEmpty() )
return false;
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.
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(
*aPos, grid.GetItemGrid( static_cast<const SCH_ITEM*>( aItem ) ) ) ) )
if( pin->IsPointClickableAnchor( grid.BestSnapAnchor( *aPos, pinGrid ) ) )
return true;
}
@ -2475,7 +2475,14 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
return false;
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;
}
case SCH_SHAPE_T:
case SCH_TEXT_T: