pcbnew: Performance improvement on moving items
This adjusts the fix for 1813038 to focus on the duplicate ghost, preventing the need to unselect/reselect in every cycle. This improves large move speeds substantially
This commit is contained in:
parent
c59fa1b672
commit
dc5e8aa609
|
@ -333,22 +333,11 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
totalMovement += movement;
|
||||
|
||||
// Drag items to the current cursor position
|
||||
//
|
||||
// We also refresh the selection VIEW_GROUP here. I'm not sure exactly what
|
||||
// needs refreshing, but updating the RTREE (via remove/add) doesn't work, nor
|
||||
// does updating the hidden flag in the view. See bug 1813038.
|
||||
m_selectionTool->ClearSelection( true /*quiet mode*/ );
|
||||
|
||||
for( EDA_ITEM* item : sel_items )
|
||||
{
|
||||
BOARD_ITEM* board_item = (BOARD_ITEM*) item;
|
||||
|
||||
// Don't double move footprint pads, fields, etc.
|
||||
if( item->GetParent() && item->GetParent()->IsSelected() )
|
||||
continue;
|
||||
|
||||
board_item->Move( movement );
|
||||
m_selectionTool->AddItemToSel( board_item, true /*quiet mode*/ );
|
||||
if( !item->GetParent() || !item->GetParent()->IsSelected() )
|
||||
static_cast<BOARD_ITEM*>( item )->Move( movement );
|
||||
}
|
||||
|
||||
frame()->UpdateMsgPanel();
|
||||
|
@ -475,7 +464,9 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
|
||||
} while( ( evt = Wait() ) ); // Assignment (instead of equality test) is intentional
|
||||
|
||||
|
@ -1014,6 +1005,9 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
// we have a selection to work on now, so start the tool process
|
||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||
|
||||
// If the selection was given a hover, we do not keep the selection after completion
|
||||
bool is_hover = selection.IsHover();
|
||||
|
||||
std::vector<BOARD_ITEM*> new_items;
|
||||
new_items.reserve( selection.Size() );
|
||||
|
||||
|
@ -1058,6 +1052,12 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
// this works well for "dropping" copies around and pushes the commit
|
||||
TOOL_EVENT evt = PCB_ACTIONS::move.MakeEvent();
|
||||
Move( evt );
|
||||
|
||||
// After moving the new items, we need to refresh the group and view flags
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
if( !is_hover )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &new_items );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue