Include both text shapes and border shapes in textbox.

Fixes https://gitlab.com/kicad/code/kicad/issues/11806
This commit is contained in:
Jeff Young 2022-07-25 16:09:27 +01:00
parent 66d6a5a9dd
commit 032708860b
3 changed files with 30 additions and 4 deletions

View File

@ -98,6 +98,25 @@ public:
m_dirty = true;
}
void AddShape( std::shared_ptr<SHAPE> aShape )
{
// Don't make clients deal with nested SHAPE_COMPOUNDs
if( aShape->HasIndexableSubshapes() )
{
std::vector<const SHAPE*> subshapes;
aShape->GetIndexableSubshapes( subshapes );
for( const SHAPE* subshape : subshapes )
m_shapes.push_back( subshape->Clone() );
}
else
{
m_shapes.push_back( aShape->Clone() );
}
m_dirty = true;
}
bool Empty() const
{
return m_shapes.empty();

View File

@ -435,7 +435,12 @@ wxString FP_TEXTBOX::GetShownText( int aDepth ) const
std::shared_ptr<SHAPE> FP_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
{
return GetEffectiveTextShape();
std::shared_ptr<SHAPE_COMPOUND> shape = GetEffectiveTextShape();
if( PCB_SHAPE::GetStroke().GetWidth() >= 0 )
shape->AddShape( PCB_SHAPE::GetEffectiveShape( aLayer, aFlash ) );
return shape;
}

View File

@ -428,10 +428,12 @@ void PCB_TEXTBOX::SwapData( BOARD_ITEM* aImage )
std::shared_ptr<SHAPE> PCB_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
{
std::shared_ptr<SHAPE_COMPOUND> shape = GetEffectiveTextShape();
if( PCB_SHAPE::GetStroke().GetWidth() >= 0 )
return PCB_SHAPE::GetEffectiveShape( aLayer, aFlash );
else
return GetEffectiveTextShape();
shape->AddShape( PCB_SHAPE::GetEffectiveShape( aLayer, aFlash ) );
return shape;
}