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