Browse Source

Pcbnew: Cross-probe - Get correct zoom direction when view flipped

CHANGED: When Pcbnew has the view flipped, it causes cross-probe zooming
to go the wrong direction.  Instead of zooming in to the selected part,
it zooms very wide.  The problem is the x dimension of the screen size
becomes a negative value when the view is flipped, so "fabs()" is used
to correct it.

Fixes https://gitlab.com/kicad/code/kicad/issues/5157
pull/16/head
PJM 5 years ago
committed by Jon Evans
parent
commit
9544c58bd7
  1. 3
      pcbnew/cross-probing.cpp

3
pcbnew/cross-probing.cpp

@ -269,7 +269,8 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
{
auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
auto screenSize = view->ToWorld( GetCanvas()->GetClientSize(), false );
screenSize.x = std::max( 10.0, screenSize.x );
// The "fabs" on x ensures the right answer when the view is flipped
screenSize.x = std::max( 10.0, fabs( screenSize.x ) );
screenSize.y = std::max( 10.0, screenSize.y );
double ratio = std::max( fabs( bbSize.x / screenSize.x ),
fabs( bbSize.y / screenSize.y ) );

Loading…
Cancel
Save