Fix handling of selection overlay in schematic editor

We weren't actually using the overlay group at all

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11142
This commit is contained in:
Jon Evans 2023-02-14 23:46:35 -05:00
parent 041b7b196d
commit 0f18a36f8f
4 changed files with 30 additions and 4 deletions

View File

@ -1805,6 +1805,9 @@ void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
SCH_BASE_FRAME::SetScreen( aScreen );
GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
}

View File

@ -115,3 +115,18 @@ BOX2I EE_SELECTION::GetBoundingBox() const
}
const std::vector<KIGFX::VIEW_ITEM*> EE_SELECTION::updateDrawList() const
{
std::vector<VIEW_ITEM*> items;
auto addItem =
[&]( EDA_ITEM* item )
{
items.push_back( item );
};
for( EDA_ITEM* item : m_items )
addItem( item );
return items;
}

View File

@ -50,6 +50,8 @@ public:
void SetScreen( SCH_SCREEN* aScreen ) { m_screen = aScreen; }
SCH_SCREEN* GetScreen() { return m_screen; }
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
};
#endif // EE_SELECTION_H

View File

@ -1906,10 +1906,13 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup
} );
}
if( aGroup && aMode != BRIGHTENED )
getView()->Hide( aItem, true );
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
getView()->Update( aItem->GetParent() );
getView()->Update( aItem->GetParent(), KIGFX::REPAINT );
else
getView()->Update( aItem );
getView()->Update( aItem, KIGFX::REPAINT );
}
@ -1923,6 +1926,9 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro
// Lines need endpoints cleared here
if( aItem->Type() == SCH_LINE_T )
aItem->ClearFlags( STARTPOINT | ENDPOINT );
if( aMode != BRIGHTENED )
getView()->Hide( aItem, false );
}
else if( aMode == BRIGHTENED )
aItem->ClearBrightened();
@ -1945,9 +1951,9 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro
}
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
getView()->Update( aItem->GetParent() );
getView()->Update( aItem->GetParent(), KIGFX::REPAINT );
else
getView()->Update( aItem );
getView()->Update( aItem, KIGFX::REPAINT );
}