GRID_HELPER: Standardize grid helper logic to dim

Places dimension tool under same snapping logic as rest of draw tools

Fixes: lp:1796498
* https://bugs.launchpad.net/kicad/+bug/1796498
This commit is contained in:
Seth Hillbrand 2018-10-06 09:50:43 -07:00
parent da3afd4abd
commit d669ae043a
1 changed files with 5 additions and 1 deletions

View File

@ -493,6 +493,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
DIMENSION* dimension = NULL;
BOARD_COMMIT commit( m_frame );
GRID_HELPER grid( m_frame );
// Add a VIEW_GROUP that serves as a preview for the new item
SELECTION preview;
@ -521,7 +522,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
VECTOR2I cursorPos = m_controls->GetCursorPosition();
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetCursorPosition(), nullptr );
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
{