Make sure preview group gets added to view after a clear.

This commit is contained in:
Jeff Young 2020-08-15 21:13:08 +01:00
parent bd14f8a82a
commit 57c3d8e8d8
5 changed files with 16 additions and 8 deletions

View File

@ -1562,6 +1562,13 @@ void VIEW::ClearPreview()
}
void VIEW::InitPreview()
{
m_preview.reset( new KIGFX::VIEW_GROUP() );
Add( m_preview.get() );
}
void VIEW::AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership )
{
Hide( aItem, false );

View File

@ -112,10 +112,9 @@ void SCH_VIEW::DisplaySheet( SCH_SCREEN *aScreen )
ResizeSheetWorkingArea( aScreen );
m_preview.reset( new KIGFX::VIEW_GROUP() );
Add( m_worksheet.get() );
Add( m_preview.get() );
InitPreview();
}
@ -171,8 +170,7 @@ void SCH_VIEW::DisplayComponent( LIB_PART* aPart )
Add( &item );
}
m_preview.reset( new KIGFX::VIEW_GROUP() );
Add( m_preview.get() );
InitPreview();
}

View File

@ -663,6 +663,8 @@ public:
std::shared_ptr<VIEW_OVERLAY> MakeOverlay();
void InitPreview();
void ClearPreview();
void AddToPreview( EDA_ITEM* aItem, bool aTakeOwnership = true );

View File

@ -102,6 +102,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
GetCanvas()->GetView()->Clear();
GetCanvas()->GetView()->InitPreview();
}
PCB_BASE_FRAME::SetBoard( aBoard );

View File

@ -1422,6 +1422,9 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
controls()->SetAutoPan( true );
frame()->UndoRedoBlock( true );
view()->ClearPreview();
view()->InitPreview();
while( TOOL_EVENT* evt = Wait() )
{
frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
@ -1456,20 +1459,17 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
previewItem->Move( offset );
}
view()->Add( previewItem );
view()->AddToPreview( previewItem );
view()->Hide( drawing, true );
}
previewItem = static_cast<BOARD_ITEM*>( module->Reference().Clone() );
previewItem->Move( offset );
view()->Add( previewItem );
view()->AddToPreview( previewItem );
view()->Hide( &module->Reference() );
previewItem = static_cast<BOARD_ITEM*>( module->Value().Clone() );
previewItem->Move( offset );
view()->Add( previewItem );
view()->AddToPreview( previewItem );
view()->Hide( &module->Value() );
}