PNS: fixed crash on via dragging

This commit is contained in:
Tomasz Wlostowski 2015-08-04 11:37:16 +02:00 committed by Maciej Suminski
parent 21b0818e58
commit 86b07d89a7
3 changed files with 36 additions and 28 deletions

View File

@ -83,6 +83,9 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
VECTOR2I p0( aVia->Pos() );
PNS_JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
if( !jt )
return false;
BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{
if( item->OfKind( PNS_ITEM::SEGMENT ) )

View File

@ -195,13 +195,19 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
{
int tl = getView()->GetTopLayer();
VECTOR2I cp = m_ctls->GetCursorPosition();
VECTOR2I p;
PNS_ITEM* startItem = NULL;
bool snapEnabled = true;
if( aEvent.IsMotion() || aEvent.IsClick() )
{
bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
snapEnabled = !aEvent.Modifier( MD_SHIFT );
p = aEvent.Position();
} else {
p = cp;
}
VECTOR2I p( aEvent.Position() );
startItem = pickSingleItem( p );
m_router->EnableSnapping ( snapEnabled );
@ -224,11 +230,6 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
m_ctls->ForceCursorPosition( false );
}
// if( startItem->Layers().IsMultilayer() )
// m_startLayer = tl;
// else
// m_startLayer = startItem->Layers().Start();
m_startItem = startItem;
}
else
@ -238,7 +239,6 @@ void PNS_TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
m_ctls->ForceCursorPosition( false );
}
}
}
void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )

View File

@ -660,7 +660,10 @@ int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
performRouting();
}
else if( evt->IsAction( &ACT_Drag ) )
{
updateStartItem( *evt );
performDragging();
}
handleCommonEvents( *evt );
}
@ -731,6 +734,8 @@ void ROUTER_TOOL::performDragging()
m_needsSync = true;
}
m_startItem = NULL;
ctls->SetAutoPan( false );
ctls->ForceCursorPosition( false );
highlightNet( false );