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
This commit is contained in:
parent
e4bc1eb3bf
commit
9544c58bd7
|
@ -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…
Reference in New Issue