ADDED: Allow Eeschema dragging graphical corners

This separates the two options (drag/move) into different actions.  Drag
will drag all graphical lines connected.  Move will disconnect the
graphical lines when moving.
This commit is contained in:
Seth Hillbrand 2020-09-11 09:31:38 -07:00
parent 03f510ff0d
commit 23a9df8a59
2 changed files with 46 additions and 26 deletions

View File

@ -581,6 +581,8 @@ bool SCH_LINE::IsConnectable() const
bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
{
if( m_Layer == LAYER_WIRE )
{
switch( aItem->Type() )
{
@ -594,11 +596,29 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
case SCH_SHEET_T:
case SCH_SHEET_PIN_T:
return true;
default:
return aItem->GetLayer() == m_Layer;
break;
}
}
else if( m_Layer == LAYER_BUS )
{
switch( aItem->Type() )
{
case SCH_JUNCTION_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_SHEET_T:
case SCH_SHEET_PIN_T:
return true;
default:
break;
}
}
return aItem->GetLayer() == m_Layer;
}
std::vector<wxPoint> SCH_LINE::GetConnectionPoints() const

View File

@ -207,8 +207,6 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
// Add connections to the selection for a drag.
//
for( EDA_ITEM* item : selection )
{
if( static_cast<SCH_ITEM*>( item )->IsConnectable() )
{
std::vector<wxPoint> connections;
@ -218,8 +216,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
connections = static_cast<SCH_ITEM*>( item )->GetConnectionPoints();
for( wxPoint point : connections )
getConnectedDragItems( (SCH_ITEM*) item, point, m_dragAdditions );
}
getConnectedDragItems( static_cast<SCH_ITEM*>( item ), point,
m_dragAdditions );
}
m_selectionTool->AddItemsToSel( &m_dragAdditions, QUIET_MODE );
@ -495,9 +493,11 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint,
EDA_ITEMS& aList )
{
for( SCH_ITEM* test : m_frame->GetScreen()->Items() )
EE_RTREE& items = m_frame->GetScreen()->Items();
for( SCH_ITEM *test : items.Overlapping( aOriginalItem->GetBoundingBox() ) )
{
if( test->IsSelected() || !test->IsConnectable() || !test->CanConnect( aOriginalItem ) )
if( test->IsSelected() || !test->CanConnect( aOriginalItem ) )
continue;
KICAD_T testType = test->Type();