GAL mode: Ensure a minimal zoom level change on mouse wheel, especially when canvas redraw takes a long time (more than 100ms)

Previously, the zoom level change could be very small ( <= 1.05, that is a very small zoom level change), especially for large boards.
This commit is contained in:
jean-pierre charras 2018-02-02 13:19:59 +01:00
parent d7cfacb6f3
commit d00fafe2ab
1 changed files with 5 additions and 1 deletions

View File

@ -114,6 +114,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
{
const double wheelPanSpeed = 0.001;
const double zoomLevelScale = 1.2; // The minimal step value when changing the current zoom level
// mousewheelpan disabled:
// wheel + ctrl -> horizontal scrolling;
@ -184,12 +185,15 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
{
zoomScale = 2.05 - timeDiff / 500;
// be sure zoomScale value is significant
zoomScale = std::max( zoomScale, zoomLevelScale );
if( rotation < 0 )
zoomScale = 1.0 / zoomScale;
}
else
{
zoomScale = ( rotation > 0 ) ? 1.05 : 1/1.05;
zoomScale = ( rotation > 0 ) ? zoomLevelScale : 1/zoomLevelScale;
}
#endif