Hide existing object when displaying moving preview.
Fixes: lp:1799478 * https://bugs.launchpad.net/kicad/+bug/1799478
This commit is contained in:
parent
0c06bdb1e0
commit
96e65c7f23
|
@ -336,8 +336,9 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
|||
|
||||
auto view = parent->GetCanvas()->GetView();
|
||||
|
||||
view->Hide( cur_pin );
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( cur_pin, false );
|
||||
view->AddToPreview( cur_pin->Clone() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#include <dialogs/dialog_lib_edit_draw_item.h>
|
||||
|
||||
|
||||
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aErase );
|
||||
static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aErase );
|
||||
|
||||
|
@ -136,7 +134,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* aPanel, wxDC* DC )
|
|||
LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_PART* LibEntry, wxDC* DC )
|
||||
{
|
||||
LIB_ITEM* item = GetDrawItem();
|
||||
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
|
||||
m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
|
||||
wxPoint drawPos = GetCrossHairPosition( true );
|
||||
|
||||
// no temp copy -> the current version of symbol will be used for Undo
|
||||
|
@ -262,8 +260,9 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
|||
|
||||
item->CalcEdit( p );
|
||||
|
||||
view->Hide( item );
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( item, false );
|
||||
view->AddToPreview( item->Clone() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,33 +298,11 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC, LIB_ITEM* aItem )
|
|||
|
||||
TempCopyComponent();
|
||||
aItem->BeginEdit( IS_RESIZED, GetCrossHairPosition( true ) );
|
||||
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
|
||||
m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
|
||||
}
|
||||
|
||||
|
||||
//! @brief Manage mouse events when creating new graphic object or modifying an graphic object.
|
||||
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aErase )
|
||||
{
|
||||
LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
|
||||
|
||||
if( item == NULL )
|
||||
return;
|
||||
|
||||
auto view = static_cast<SCH_DRAW_PANEL*>(aPanel)->GetView();
|
||||
|
||||
auto cp = aPanel->GetParent()->GetCrossHairPosition( true );
|
||||
|
||||
DBG(printf("SymbolDisplayDraw\n");)
|
||||
|
||||
item->CalcEdit( cp );
|
||||
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( item, false );
|
||||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
|
||||
{
|
||||
LIB_ITEM* item = GetDrawItem();
|
||||
|
|
|
@ -1058,9 +1058,6 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
|
|||
|
||||
for( auto& item : temp->GetDrawItems() )
|
||||
{
|
||||
if( aComp->IsMoving() )
|
||||
item.SetFlags( IS_MOVED );
|
||||
|
||||
auto rp = aComp->GetPosition();
|
||||
auto ip = item.GetPosition();
|
||||
item.Move( wxPoint( rp.x + ip.x, ip.y - rp.y ) );
|
||||
|
@ -1076,7 +1073,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
|
|||
|
||||
for( SCH_FIELD* field : fields )
|
||||
{
|
||||
if( field->GetId() == REFERENCE || !field->IsMoving() )
|
||||
if( !field->IsMoving() )
|
||||
draw( field, aLayer );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -680,6 +680,7 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
|
||||
SCH_ITEM* item = screen->GetCurItem();
|
||||
auto panel = static_cast<SCH_DRAW_PANEL*>( aPanel );
|
||||
auto view = panel->GetView();
|
||||
|
||||
wxCHECK_RET( (item != NULL), wxT( "Cannot move invalid schematic item." ) );
|
||||
|
||||
|
@ -688,12 +689,9 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
|
||||
item->SetPosition( cpos );
|
||||
|
||||
// Draw the item at it's new position.
|
||||
item->SetWireImage(); // While moving, the item may choose to render differently
|
||||
|
||||
auto view = panel->GetView();
|
||||
view->Hide( item );
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( item, false );
|
||||
view->AddToPreview( item->Clone() );
|
||||
|
||||
// Needed when moving a bitmap image to avoid ugly rendering and artifacts,
|
||||
// because a bitmap is drawn only as non cached
|
||||
|
@ -745,7 +743,6 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
|||
// Just restore its data
|
||||
currentItem->SwapData( oldItem );
|
||||
|
||||
// Erase the wire representation before the 'normal' view is drawn.
|
||||
view->Hide( item, false );
|
||||
|
||||
item->ClearFlags();
|
||||
|
@ -769,15 +766,17 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem )
|
|||
SetUndoItem( aItem );
|
||||
}
|
||||
|
||||
aItem->SetFlags( IS_MOVED );
|
||||
|
||||
if( aItem->Type() == SCH_FIELD_T && aItem->GetParent()->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
RefreshItem( aItem );
|
||||
|
||||
// Now that we're moving a field, they're no longer autoplaced.
|
||||
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( aItem->GetParent() );
|
||||
parent->ClearFieldsAutoplaced();
|
||||
}
|
||||
|
||||
aItem->SetFlags( IS_MOVED );
|
||||
|
||||
// For some items, moving the cursor to anchor is not good
|
||||
// (for instance large hierarchical sheets od componants can have
|
||||
// the anchor position outside the canvas)
|
||||
|
|
|
@ -348,8 +348,10 @@ static void resizeSheetWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const
|
|||
|
||||
auto panel = static_cast<SCH_DRAW_PANEL*>( aPanel );
|
||||
auto view = panel->GetView();
|
||||
|
||||
view->Hide( sheet );
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( sheet, false );
|
||||
view->AddToPreview( sheet->Clone() );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue