Prevent UI updates from changing zoom selection
The zoom selection should only change when requested by the user, not in
response to UI updates. This can cause unexpected zoom shifts when the
calculated zoom is within a range of one of the presets. It also adds
unneeded calls during the UI update cycle
Fixes https://gitlab.com/kicad/code/kicad/issues/10498
(cherry picked from commit 6810479a19
)
This commit is contained in:
parent
b084115a9e
commit
4c8f556b80
|
@ -72,7 +72,6 @@
|
|||
|
||||
BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
|
||||
EVT_UPDATE_UI( ID_ON_GRID_SELECT, EDA_DRAW_FRAME::OnUpdateSelectGrid )
|
||||
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, EDA_DRAW_FRAME::OnUpdateSelectZoom )
|
||||
|
||||
EVT_ACTIVATE( EDA_DRAW_FRAME::onActivate )
|
||||
END_EVENT_TABLE()
|
||||
|
@ -473,30 +472,6 @@ void EDA_DRAW_FRAME::UpdateZoomSelectBox()
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( m_zoomSelectBox == nullptr || m_zoomSelectBox->GetParent() == nullptr )
|
||||
return;
|
||||
|
||||
int current = 0; // display Auto if no match found
|
||||
|
||||
// check for a match within 1%
|
||||
double zoom = GetCanvas()->GetGAL()->GetZoomFactor();
|
||||
|
||||
for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); i++ )
|
||||
{
|
||||
if( std::fabs( zoom - config()->m_Window.zoom_factors[i] ) < ( zoom / 100.0 ) )
|
||||
{
|
||||
current = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( current != m_zoomSelectBox->GetSelection() )
|
||||
m_zoomSelectBox->SetSelection( current );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
||||
{
|
||||
wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" );
|
||||
|
|
|
@ -246,11 +246,6 @@ public:
|
|||
*/
|
||||
void UpdateZoomSelectBox();
|
||||
|
||||
/**
|
||||
* Update the checked item in the zoom combobox.
|
||||
*/
|
||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Return a human readable value for display in dialogs.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue