Allow measure tool to survive zoom and pan.

Fixes: lp:1792232
* https://bugs.launchpad.net/kicad/+bug/1792232
This commit is contained in:
Jeff Young 2018-09-14 10:59:38 +01:00
parent a5e2ddd65a
commit e3f74646b9
1 changed files with 5 additions and 19 deletions

View File

@ -1223,14 +1223,10 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
} }
// click or drag starts // click or drag starts
else if( !originSet && else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
{ {
if( !evt->IsDrag( BUT_LEFT ) ) twoPtMgr.SetOrigin( cursorPos );
{ twoPtMgr.SetEnd( cursorPos );
twoPtMgr.SetOrigin( cursorPos );
twoPtMgr.SetEnd( cursorPos );
}
controls.CaptureCursor( true ); controls.CaptureCursor( true );
controls.SetAutoPan( true ); controls.SetAutoPan( true );
@ -1238,17 +1234,8 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
originSet = true; originSet = true;
} }
else if( !originSet && evt->IsMotion() )
{
// make sure the origin is set before a drag starts
// otherwise you can miss a step
twoPtMgr.SetOrigin( cursorPos );
twoPtMgr.SetEnd( cursorPos );
}
// second click or mouse up after drag ends // second click or mouse up after drag ends
else if( originSet && else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
{ {
originSet = false; originSet = false;
@ -1257,8 +1244,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
} }
// move or drag when origin set updates rules // move or drag when origin set updates rules
else if( originSet && else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
{ {
twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) ); twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
twoPtMgr.SetEnd( cursorPos ); twoPtMgr.SetEnd( cursorPos );