From 38464827fc2a5ba866a77186c205bc569d0adc14 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 9 Aug 2018 00:44:45 +0100 Subject: [PATCH] Fix some issues with zooming. Don't process zoom both in Legacy code and Modern code; one of them will decide the zoom has already changed and do odd things. Make sure the view is updated after zooming, otherwise you have to move the mouse over the canvas before seeing the new zoom. --- common/draw_frame.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 215e5ea981..b716a8db1b 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -524,28 +524,23 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) ) return; - if( id == 0 ) // Auto zoom (Fit in Page) + if( IsGalCanvasActive() ) + { + m_toolManager->RunAction( "common.Control.zoomPreset", true, id ); + UpdateStatusBar(); + m_galCanvas->Refresh(); + } + else if( id == 0 ) // Auto zoom (Fit in Page) { Zoom_Automatique( true ); + m_canvas->Refresh(); } else { double selectedZoom = GetScreen()->m_ZoomList[id-1]; - if( GetScreen()->GetZoom() == selectedZoom ) - return; - - GetScreen()->SetZoom( selectedZoom ); - RedrawScreen( GetScrollCenterPosition(), false ); - } - - // Notify GAL - TOOL_MANAGER* mgr = GetToolManager(); - - if( mgr && IsGalCanvasActive() ) - { - mgr->RunAction( "common.Control.zoomPreset", true, id ); - UpdateStatusBar(); + if( GetScreen()->SetZoom( selectedZoom ) ) + RedrawScreen( GetScrollCenterPosition(), false ); } }