Enable horizontal scroll panning

Allow a horizontal scroll event to fall through to the panning branch.

This still restricts zooming to use only the vertical axis, but it
(re-?)enables the horizontal pan function that currently doesn't work
even if the user has set "allow horizontal panning", as the horizontal
scroll doesn't have a modifier, which is the default for vertical scroll
zoom, and thus it skips over the whole panning branch.

If the user has not set horizontal panning, the earlier early return
means that there is no handling of any horizontal scroll event, so this
won't change anything for these users.
This commit is contained in:
John Beard 2024-05-20 17:48:42 +08:00
parent caee430761
commit ce758adca3
1 changed files with 16 additions and 19 deletions

View File

@ -369,28 +369,25 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
// Restrict zoom handling to the vertical axis, otherwise horizontal
// scrolling events (e.g. touchpads and some mice) end up interpreted
// as vertical scroll events and confuse the user.
if( modifiers == m_settings.m_scrollModifierZoom )
if( modifiers == m_settings.m_scrollModifierZoom && axis == wxMOUSE_WHEEL_VERTICAL )
{
if ( axis == wxMOUSE_WHEEL_VERTICAL )
const int rotation = aEvent.GetWheelRotation();
const double zoomScale = m_zoomController->GetScaleForRotation( rotation );
if( IsCursorWarpingEnabled() )
{
const int rotation = aEvent.GetWheelRotation();
const double zoomScale = m_zoomController->GetScaleForRotation( rotation );
if( IsCursorWarpingEnabled() )
{
CenterOnCursor();
m_view->SetScale( m_view->GetScale() * zoomScale );
}
else
{
const VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
}
// Refresh the zoom level and mouse position on message panel
// (mouse position has not changed, only the zoom level has changed):
refreshMouse( true );
CenterOnCursor();
m_view->SetScale( m_view->GetScale() * zoomScale );
}
else
{
const VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
}
// Refresh the zoom level and mouse position on message panel
// (mouse position has not changed, only the zoom level has changed):
refreshMouse( true );
}
else
{