Pcb: Get proper "Break Track" location when invoked from RMB context menu
When invoking "Break Track" from the RMB context menu, Pcbnew gets and uses the current position of the mouse to figure out where to break the track. The problem is that the mouse has to be moved to select the "Break Track" menu item, and the mouse position used is wrong. This can result in the break in the wrong location or not happening at all. CHANGED: This commit determines if the "Break Track" was invoked from a context menu or a hotkey. If a hotkey, it uses the current mosue position. If a context menu, it uses the original postion of the mouse when the menu was opened.
This commit is contained in:
parent
eea8869bdd
commit
258d1a1971
|
@ -429,6 +429,11 @@ public:
|
|||
*/
|
||||
bool DispatchHotKey( const TOOL_EVENT& aEvent );
|
||||
|
||||
VECTOR2D GetMenuCursorPos()
|
||||
{
|
||||
return m_menuCursor;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
||||
|
||||
|
|
|
@ -1540,8 +1540,23 @@ int ROUTER_TOOL::InlineBreakTrack( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_router->SyncWorld();
|
||||
m_startItem = m_router->GetWorld()->FindItemByParent( item );
|
||||
m_startSnapPoint = snapToItem( true, m_startItem, controls()->GetCursorPosition() );
|
||||
|
||||
TOOL_MANAGER* toolManager = frame()->GetToolManager();
|
||||
|
||||
if( toolManager->IsContextMenuActive() )
|
||||
{
|
||||
// If we're here from a context menu then we need to get the position of the
|
||||
// cursor when the context menu was invoked. This is used to figure out the
|
||||
// break point on the track.
|
||||
VECTOR2I CurrPos = toolManager->GetMenuCursorPos();
|
||||
m_startSnapPoint = snapToItem( true, m_startItem, toolManager->GetMenuCursorPos() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we're here from a hotkey, then get the current mouse position so we know
|
||||
// where to break the track.
|
||||
m_startSnapPoint = snapToItem( true, m_startItem, controls()->GetCursorPosition() );
|
||||
}
|
||||
|
||||
if( m_startItem && m_startItem->IsLocked() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue